Checking if Hotkey exists in Dialog?

Using dlg.AddHotkey() with a name or key that has already been assigned throws an error. So does calling dlg.DelHotkey() if the hotkey doesn't exist. Is there a way to check if it does? Perhaps you could add a HasHotkey() function? I could use try/catch but that's not very elegant...

(Explanation: My hotkeys are assigned to cursor up/down, but are valid only for one specific (single-line Edit) control.. I want to delete them when leaving the control and add them again when it receives focus.)

Alternatively, is there a different way to react to specific keys in an Edit control?

Thanks!

We'll make those functions simply return true/false to indicate success, rather than throwing a script error.

1 Like