Popup Menu Hot-Keys are blocking other gadgets

BlitzMax Forums/MaxGUI Module/Popup Menu Hot-Keys are blocking other gadgets

LordChaos(Posted 2008) [#1]
Here's a strange one (again Win32MaxGUI): when keys are declared as hotkeys for popup menus (only for them), the input on textareas is blocked for these specific keys.

SuperStrict


Local wnd:TGadget = CreateWindow("window", 100, 100, 300, 200, Null)


Global mnu:TGadget = CreateMenu("popup", 0, WindowMenu(wnd))
 CreateMenu("blub", 1, mnu, KEY_ENTER)

Local txa:TGadget = CreateTextArea(0, 0, ClientWidth(wnd), ClientHeight(wnd), wnd)
SetGadgetText(txa, "Try to begin a new line in here!")


Repeat

 WaitEvent()

 Select EventID()
  Case EVENT_WINDOWCLOSE
    End
 End Select

Forever



SebHoll(Posted 2008) [#2]
Here's a strange one (again Win32MaxGUI): when keys are declared as hotkeys for popup menus (only for them), the input on textareas is blocked for these specific keys.

Unfortunately LordChaos, this is by design. Setting the hotkey overrides the default key behaviour.

If you want to catch the enter key in text areas, then use the SetGadgetFilter command with a custom callback function.


Ghost Dancer(Posted 2010) [#3]
Sorry to drag up this old thread, but I'm having the same problem. A popup menu in one window is overriding keys for the text area in a second window - this applies to both text field & text area. Surely separate windows should not share the same hot keys?

SetGadgetFilter does not catch the key presses either, but even if it did it seems a bit clunky to code functionality that already exists for the text gadgets.

Some code to illustrate this problem:



As you can see, Return/Delete only works int he text area if the corresponding menu options are commented out. Likewise the filter function does not work if the keys are used in the menu options.

I've tried freeing up the menu before opening the second window but that does not work either.

I need to find a workaround for this as it is essential to the workings of my application and I really need to use Return & Delete on my popup menu. Any help would be greatly appreciated. Thanks.


Ghost Dancer(Posted 2010) [#4]
I've managed to code a workaround for this by using SetGadgetHotKey to disable the menu hotkeys before the second window is opened, and then enabling the hotkeys again when the window is closed (the window is modal).

Not sure if it is a bug, but shouldn't the hotkey be disabled/freed along with the menu item when using DisableGadget/FreeGadget?