Christian Convey wrote:
> I've got an app that uses FLTK 1.1.7 (and now, 1.1.9).
>
> The app originally received messages from an external source in a secondary
> thread.
> In that secondary thread the app would call Fl::lock(), make the GUI changes
> related to the received message, and call Fl::unlock().
>
> Because of some lock contention issues, I switched to having all GUI calls
> occur in my main GUI thread. That seemed to go smoothly, but now I have a
> very strange problem: my menu hotkeys no longer seem to work.
>
> For example, I have a menu entry labeled, "Pan Up", and its hotkey is FL_Up.
> When the user hits the up arrow on they keyboard, an OpenGL image we have
> would pan appropriately.
>
> Now, however, when I press the up arrow on they keyboard, I see an insertion
> cursor move from one of the app's input fields to another input field (as
> though I were tabbing through the fields), rather than causing my OpenGL
> image to pan. However, if I use my mouse to click on the "Pan up" menu
> entry, the OpenGL image still scrolls fine.
Yes, if you have more than one input widget on the screen,
they'll accept UP/DOWN keys for themselves as navigation
if they have focus.
To bring sanity to an interface that has multiple widgets
all on screen competing for the same keystrokes, focus is
the way to control it.
Menubars do not take focus, so they'll only respond to events
if no other widget is taking them.
Your GL window should probably be configured to take focus,
so that when it has it, it gets first dibs at keystroke events
before the other widgets.
This would mean having your GL window accept and respond to
focus events as per the docs on handling events, ie. handle()ing
FL_FOCUS, FL_UNFOCUS, etc. by return()ing 1, and also return()ing
1 when you receive up/down arrow events, so that they aren't passed
on to other widgets.
See "Focus Events" and "Keyboard Events" on this page:
http://fltk.org/documentation.php/doc-1.1/events.html#events
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk