Re: Give keyboard focus to GtkMenu



I discovered that if my application's main window is focused when I pop-up
the GtkMenu anywhere on the screen, the GtkMenu also has keyboard focus
and can be navigated using the keyboard keys.

However, if my application's main window does _not_ have focus, that's
when the menu doesn't receive keyboard focus and can't be navigated using
the keyboard, though this is what I'm trying to accomplish: keyboard focus
to a GtkMenu even if the main window isn't in the foreground and doesn't
have focus.


> I'm popping-up a GtkMenu at random coordinates on the screen (outside of
> my application's main window). I'd like to give keyboard focus to this
> GtkMenu.
>
> Since I'm using Windows, I tried:
>
> SetForegroundWindow(GDK_WINDOW_HWND(menu->window));
>
> But that causes the menu to immediately disappear, as does:
>
> SetFocus(GDK_WINDOW_HWND(menu->window));
>
> I also tried:
>
> GTK_WIDGET_SET_FLAGS(menu, GTK_CAN_FOCUS);
> gtk_widget_grab_focus(menu);
>
> But that doesn't do anything at all. Any ideas? I'm trying to make it so
> that the user can navigate the menu using their keyboard.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]