GetKeyState for Wheel

Report problems with documented functionality
serzh82saratov
Posts: 45
Joined: 01 Jul 2017, 03:04

GetKeyState for Wheel

28 Jul 2018, 05:10

Code: [Select all] [Download] GeSHi © Codebox Plus

WheelUp::ToolTip % GetKeyState("WheelUp", "P")
#InputLevel, 100
3::Send {WheelUp}

If you first press 3, there will always be false, if you touch WheelUp, always true, before the next launch.
I understand that Wheel does not have an Up event, but you can make a definition of a physical or emulated push, since this can now be done with the rest of the keys.
For example, button 2.

Since at the moment, GetKeyState for Wheel does not work, and is more misleading, I suggest keeping the flag for the last pressing of Wheel - physical or emulated, from this will be at least some useful.
In any case, it is not difficult to do for hotkeys mousehook.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

malcev
Posts: 88
Joined: 12 Aug 2014, 12:37

Re: GetKeyState for Wheel

07 Aug 2018, 07:40

May be it would be logical to remove mouse wheel from recognition and return empty string?
lexikos
Posts: 6045
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: GetKeyState for Wheel

07 Aug 2018, 20:25

I'm not sure how it could be misleading (WheelUp is not a key or button and doesn't have any state, so what are you expecting?), but at least using GetKeyState to retrieve the last wheel delta value is a good idea. v2-alpha removes all other uses of A_EventInfo, so if this is done, A_EventInfo can be removed.
but you can make a definition of a physical or emulated push, since this can now be done with the rest of the keys.
I do not understand. Firstly, "the rest of the keys" is inappropriate since WheelUp is not a key (it represents a state transition of the wheel). Secondly, as you said, there is no up event. Keys have down and up events and state (pressed or not, down or up) based on these events. Whether it is physical or emulated is irrelevant. Send {2} will send a down event and an up event, whereas Send {WheelUp} will just send a WheelUp event.
malcev
Posts: 88
Joined: 12 Aug 2014, 12:37

Re: GetKeyState for Wheel

08 Aug 2018, 04:02

lexikos wrote:I'm not sure how it could be misleading (WheelUp is not a key or button and doesn't have any state, so what are you expecting?)

I am expecting to get empty string, because:
If KeyName is invalid or the state of the key could not be determined, an empty string is returned.

https://autohotkey.com/docs/commands/GetKeyState.htm
And it is strange thing:

Code: [Select all] [Download] GeSHi © Codebox Plus

WheelUp::ToolTip % GetKeyState("WheelUp", "P")
#InputLevel, 100
f11::Send {WheelUp}

If we run this code and press f11 then we will get 0.
After that we press wheelUp button - we will get 1.
After that we press f11 then we will get 1.

But this code works OK - always shows 1.
Helgef
Posts: 3097
Joined: 17 Jul 2016, 01:02
Contact:

Re: GetKeyState for Wheel

08 Aug 2018, 05:00

KeyName wrote:This can be just about any single character from the keyboard or one of the key names from the key list

The mouse wheels are in the key list. Since you do not get an empty string back, there was no failure in determining the state, so it works as documented. I can sympathise with the idea that the mouse wheels shouldn't be valid input, but now they are, so we have to hope for v2, unless there is some good reason they should be valid as input which we have failed to realise yet.

Cheers.
serzh82saratov
Posts: 45
Joined: 01 Jul 2017, 03:04

Re: GetKeyState for Wheel

08 Aug 2018, 08:47

I understand that GetKeyState in any cases is not needed for the Wheel, so it does not matter how it behaves now. But...
Whether it is physical or emulated is irrelevant.

It still can carry some kind of benefit, for example, I want it to be physical pressures that are blocked, and for all other keys it's easy to do.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus


It turns out that Enter only works when you press 1 as I need it, and WheelUp in no case.
serzh82saratov
Posts: 45
Joined: 01 Jul 2017, 03:04

Re: GetKeyState for Wheel

08 Aug 2018, 09:04

That is, the benefit of GetKeyState for Wheel can only be at the very moment of pressing, so let it be at least the way, the more it is very easy to do.

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 1 guest