I know how to prevent the window to close like you mentioned here, but the point is I want the escape key close the window, what I don't want is the window be closed when I expect only to close/hide the popup menu without select any item.
I expect the popup to behave like a window and respond to the escape key and consume it, this way I can continue working with the actual window and as well close it with the escape key later on. On Fri, 22 Apr 2011 18:33:53 +0200, Greg Ercolano <[email protected]> wrote: > Domingo Alvarez Duarte wrote: >> I want to have a popup menu comes up through the menu key on the >> keyboard >> "Fl_Menu", I managed to do that but the problem is if I want to close >> the >> popup menu without select any entry, using the escape key the whole >> window >> closes, but I expect only the popup menu to be closed. >> >> I'm missing something here ? > > To disable the default "Esc key closes window" behavior, > setup a callback() for the window that does the following: > > void YourWindow_Callback(Fl_Widget *w, void*) { > if ( Fl::event_key() == FL_Escape ) return; // ignore Escape > w->hide(); // hide window (can also call exit(0) or _exit(0)) > } > > Seems like there was a FAQ item in Bill's documentation manual > that covered this (I think it's a holdover from forms/xforms) > but I can't find it now. Anyway that, or something like it should work. > _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

