Combination hotkey can't be triggered when it or a variant is defined before another hotkey

Report problems with documented functionality
User avatar
NovaChromatic
Posts: 22
Joined: 21 Dec 2021, 09:28
Contact:

Combination hotkey can't be triggered when it or a variant is defined before another hotkey

09 Feb 2024, 06:35

Pressing 234 here works as expected and triggers the 2 - 34 (3 & 4) hotkey, displaying the 2 - 34 tooltip:

Code: Select all

Hotkey('2 & 4', (thisHotkey) => ToolTip('24'))

HotIf((thisHotkey) => GetKeyState('2', 'P'))
Hotkey('3 & 4', (thisHotkey) => ToolTip('2 - 34'))
But If I define the the 2 - 34 hotkey before the 24 hotkey, then pressing 234 does not trigger the 2 - 34 hotkey but the 24 hotkey:

Code: Select all

HotIf((thisHotkey) => GetKeyState('2', 'P'))
Hotkey('3 & 4', (thisHotkey) => ToolTip('2 - 34'))

HotIf()
Hotkey('2 & 4', (thisHotkey) => ToolTip('24'))
This behavior applies any time I define a variant of 3 & 4 before 2 & 4. Pressing 234 using the following code just triggers the 24 hotkey again:

Code: Select all

Hotkey('3 & 4', (thisHotkey) => ToolTip('34'))
Hotkey('2 & 4', (thisHotkey) => ToolTip('24'))

HotIf((thisHotkey) => GetKeyState('2', 'P'))
Hotkey('3 & 4', (thisHotkey) => ToolTip('2 - 34'))
But if I switch around the definitions of the 34 hotkey and the 24 hotkey, then pressing 234 triggers the 2 - 34 hotkey like I expect:

Code: Select all

Hotkey('2 & 4', (thisHotkey) => ToolTip('24'))
Hotkey('3 & 4', (thisHotkey) => ToolTip('34'))

HotIf((thisHotkey) => GetKeyState('2', 'P'))
Hotkey('3 & 4', (thisHotkey) => ToolTip('2 - 34'))
I initially observed this behavior with #HotIf. The following works as I expect:

Code: Select all

2 & 4:: ToolTip('24')
3 & 4:: ToolTip('34')

#HotIf GetKeyState('2', 'P')
3 & 4:: ToolTip('2 - 34')
But switch around again the definitions of the 24 hotkey and the 34 hotkey and the 2 - 34 hotkey does not trigger when pressing 234.

Code: Select all

3 & 4:: ToolTip('34')
2 & 4:: ToolTip('24')

#HotIf GetKeyState('2', 'P')
3 & 4:: ToolTip('2 - 34')
Maybe this is intended functionality, but I can't find it documented.
lexikos
Posts: 9665
Joined: 30 Sep 2013, 04:07
Contact:

Re: Combination hotkey can't be triggered when it or a variant is defined before another hotkey

15 Feb 2024, 22:52

I'm not seeing how this is a bug. As far as I can recall, there are no documented guarantees about the precedence of custom combinations when more than one combination could apply.

It may be easy to see what behaviour is desired when you are intending to implement combinations of three keys, but any guarantees about precedence would need to take other scenarios into account. These are really only combinations of two keys each, which is all that custom combinations are purported to (and designed to) support.

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 10 guests