|
From: <je...@fo...> - 2023-07-12 13:00:31
|
On 2023-07-11 13:45, Enno Rehling wrote:
> Hi,
>
> my application creates context menus with FXMenuPane when a list item
> is right-clicked, like so:
>
> FXMenuPane pane(this);
> new FXMenuCommand(&pane, "&Foo", nullptr, this, ID_FOO);
> new FXMenuCommand(&pane, "&Bar", nullptr, this, ID_BAR);
> pane.create();
> pane.popup(nullptr, event->root_x, event->root_y);
> getApp()->runModalWhileShown(&pane);
>
> This works as long as I select the menu items with the mouse, and the
> menu can be closed by clicking out of bounds. However, there is no
> keyboard navigation. I can neither navigate the menu with the arrow
> keys, nur can I use the F and B accelerators, or close the menu with
> ESC. Pressing any key results in an application beep. How can I fix
> this?
>
> And in a related question, what is the fxkeys.h constant for the menu
> key (or application key) on a Windows keyboard? The one that opens
> context menus, and was introduced with the Windows keys. It's not
> KEY_Menu, that one seems to be from some legacy keyboard.
I made a note of this problem. The issue is difficult and may some
time to fix.
Of course, the reason its not a widely expressed problem is that the
popup must have been popped up with the mouse, and thus one would
typically then use the mouse to use the popup menu, rather than
switch to the keyboard.
I know an attempt was made with grabKeyboard()/ungrabKeyboard() and
this will have the effect of delivering all the keyboard events to
the grabbed window.
The problem is what happens if you have a sub-pupup. Grabbing the
sub-popup would have to know where to revert the grab to when unpopped.
However, some popup menus may be either poppup up via context right-
click, and sometimes from pulldown menu.
The pulldown menus get their key events delivered via the normal
focus-chain from the top-window. There are some interactions.
-- JVZ
|