> Moved this question from STR#2482; Ingvar writes:
> > [while using FLTK+glut]
> > I tried to make my own key-up callback function, and calling it from the
> > handle:
> > int UI::handle() {
> > switch (Fl::event()) {
> > case FL_KEYUP:
> > //printf("You released: %c\n", Fl::event_key());
> > callMyKeyboardUpFunc(Fl::event_key(), 0, 0); //TODO: FIX, TEST!!
> > break;
> >
> > But for some reason, the handle function is not receiving any events since
> > I added my glut code.
>
> You should maybe show us a bit more, but note the
> handle() function's signature takes an int parameter as well.
>
> So you must change:
>
> BEFORE: int UI::handle() {
> AFTER: int UI::handle(int e) {
>
> ..to receive events properly.
>
> Also, then you can use 'e' instead of Fl::event()
> in your switch().
>
> Be sure to also pass the event down to the base class widget
> (whatever FLTK widget your "UI" class derives from) to prevent
> eclipsing events from the widget.
>
> Also, be sure to preserve the return value of the base class's
> handle() call, and pass it through your call. eg:
>
>
> int UI::handle(int e) {
> int ret = Fl_SomeBaseClass::handle(e);
> switch (e) {
> ..do stuff, setting 'ret=1;' if you handled and event..
> }
> return(ret);
> }
>
> ..where Fl_SomeBaseClass is the name of the FLTK class your UI
> widget derives from.
Hello
Thanks for the tips
I changed it to
int UI::handle(int e) {
and this is my code to create my window with GLUT content and FL content and
start the application:
window = ui->make_window(); //This adds all FL components - built with fluid
window->show();
window->begin();
glutInitWindowSize(635, 745);
glutInitWindowPosition(431, 0);
glutCreateWindow("libjpeg test");
window->end();
glutReshapeFunc(reshape);
glutDisplayFunc(display);
glutIdleFunc(idle);
glutKeyboardFunc(key);
glutKeyboardUpFunc(keyup);
glutMouseFunc(mouse);
glutMotionFunc(mousemove);
glutPassiveMotionFunc(mousemove);
glutSpecialFunc(specialkey);
glutSpecialUpFunc(specialkeyup);
...more GL stuff - enable this, disable that...
Fl::run();
If I put a break point at the very beginning of the handle function, it still
never receives any events. I.e. my break point is never triggered. VC6.0 SP6.
They do reach my glut code, but not the FL handle. Perhaps it's supposed to be
that way?
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk