[SOLVED] What could keep a hotkey from working in a GUI?

Started by imagazzell, Wed 25/05/2022 03:40:30

Previous topic - Next topic

imagazzell

Hi guys,

I've been working on setting up my hotkeys for optional keyboard control, and so far everything had been working fine. However, in my custom savegame GUI, while the arrow and escape keys still work fine, the return (enter) key is not responding with its hotkey assignment (Mouse.Click), in just this one GUI. If I hit enter on any of the GUI's buttons, nothing happens, yet if I click those same buttons with the mouse, they work fine.

What could cause this misbehavior? I've tried using other hotkey assignments for the enter key (e.g., GUI.ProcessClick), as well as directly calling the buttons' functions, all to no avail.

My only guess is that it may have something to do with the fact that I have a text box (for entering savegame names) in that GUI, and since that requires the keyboard for typing in names, maybe that's overriding the use of the enter key or something...?

Any ideas and suggestions are much appreciated!
Music Composing Services: https://youtu.be/BbT3kfhgA4E

Snarky

Quote from: AGS ManualIf a text box is on a currently displayed GUI, all standard keypresses (i.e. letter keys, return and backspace) are diverted to the textbox instead of being passed to the on_key_press function. When the player presses Return in the text box, the OnActivate event is called.

imagazzell

*facepalm* Thanks, Snarky. I hadn't seen that, but at least now I know my intuition was on the right track, and it led me to a solution. I added my Mouse.Click command to the OnActivate event and voila, got me the behavior I was looking for. Thanks again.
Music Composing Services: https://youtu.be/BbT3kfhgA4E

SMF spam blocked by CleanTalk