My handle function is completely trivial (for testing) :

int FROG_MainWindow::handle(int e){
        return Fl_Gl_Window::handle(e);
}

and the menutable is an exact copy/paste of the table proposed in the SDK 
(menubar.cxx)

So I do not understand...

Do you agree that the handle function can be on the "opengl" class
FROG_MainWindow.  Or should I necessary need 2 handle function, one for the 
main window, and the second one for the opengl (sub-)window.

I guess, that the default handle function will call the handle of the opengl 
sub-window, since it is a children of the main window.

If I just press the "right" key of the keyboard, the soft crashes...
For me this is strange.

Loic,


> Loic wrote:
> > Hi all,
> >
> > sorry for spamming, but I have an other problem...
> > I change my code to include a menubar. (as in the example)
> >
> > my old code :
> > -------------------------------
> > Fl_Window* window = new Fl_Window(0,0,WINDOW_WIDTH,WINDOW_HEIGHT, "FROG 
> > Displayer");
> > window->end();
> > window->resizable(window);
> > window->show();
> >
> > while(window->shown()){
> >    Fl::check();
> >    window->redraw();
> > }
> > -------------------------------
> >
> > Has been changed to
> > -------------------------------
> > Fl_Window* window = new Fl_Window(0,0,WINDOW_WIDTH,WINDOW_HEIGHT+20, "FROG 
> > Displayer_Main");
> > FROG_MainWindow* frog_window = new 
> > FROG_MainWindow(0,20,WINDOW_WIDTH,WINDOW_HEIGHT, "FROG Displayer");
> > frog_window->end();
> > frog_window->resizable(frog_window);
> > frog_window->show();
> > frog_window->end();
> >
> > Fl_Menu_Bar* menubar = new Fl_Menu_Bar(0,0,WINDOW_WIDTH,20);
> > menubar->menu(menutable);
> > menubar->callback(test_cb);
> > menubar->show();
> >
> > window->end();
> > window->resizable(window);
> > window->show();
> >
> > while(window->shown()){
> >     Fl::check();
> >     frog_window->redraw();
> > }
> > -------------------------------
> >
> > But the callback get crazy...
> > for mouse callback everything seems to be fine...
>
> > but for keyboard callback..
>
>       Hmm, what's a "keyboard callback" mean in this context?
>
>       To read the keyboard you usually have to setup a handle()
>       to trap events, unless I'm forgetting something. Or maybe
>       you've got keyboard shortcuts enabled for certain menu items,
>       but that should trigger the same callback as the mouse, so
>       it'd be odd if one worked and the other did not.
>
> > either the program crashes or it does nothing (while it is suppose to do 
> > something with the key pressed).
>
>       Hard to tell from the code you've posted, as it's missing what's
>       going on in the callback and menutable, which is where the problem
>       likely lies.
>
>       If it crashes, it might be the menutable isn't NULL terminated 
> correctly..
>       or the callback is doing something it shouldn't with the widget or 
> userdata
>       pointers.
>
>       Building the menutable is a careful business to do manually -- usually
>       I only let fluid handle building menu tables, as submenus need special
>       extra NULL terminations, IIRC.
>
>       I prefer to use menubar->add() to build a menubar in contexts outside
>       of fluid, eg:
>
>               menubar->add("File/Save", ..);
>               menubar->add("File/Save As", ..);
>               menubar->add("File/Quit", ..);
>               menubar->add("Edit/Copy", ..);
>
>       For more info, see this example:
>       http://seriss.com/people/erco/fltk/#Fl_Menu_Bar_Single_Callback
>
>       BTW, since this is most likely a non-opengl issue, it's better
>       to use fltk.general for this kinda stuff; you'll get more replies,
>       and the back+forths will be more useful to folks on that group.
>
>       Try running the debugger to see where it crashes..

_______________________________________________
fltk-opengl mailing list
fltk-opengl@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-opengl

Reply via email to