Hello,
I'm trying to get state of arrow keys by using function getKeyState() in WinCC OA v3.14
it works for letter keys, for example:
getKeyState('A');
or for mouse buttons:
getKeyState(MOUSE_LBUTTON);
but for arrow keys there is no result:
getKeyState(KEY_LEFT);
getKeyState(KEY_RIGHT);
getKeyState(KEY_UP);
and probably getKeyState(KEY_DOWN); (not tried it) not works.
Is this a bug, or maybe I'm doing something wrong?
Best Regards
Dmytro Komsheliuk
Can\'t get state of arrow keys
Search
Re: Can\'t get state of arrow keys
It is a bug. Also please note that this function is currently only available on windows, so in portable code you should not use it.
-
- Posts: 9
- Joined: Tue Dec 22, 2015 11:13 am
Re: Can\'t get state of arrow keys
Thanks
hope it will be fixed in next version

Re: Can\'t get state of arrow keys
The bug are wrong key codes.
As a workaround, you can define your own constants and use the following values instead.
(Did not test them but these were the values before they were changed):
KEY_LEFT 37
KEY_UP 38
KEY_RIGHT 39
KEY_DOWN 40
As a workaround, you can define your own constants and use the following values instead.
(Did not test them but these were the values before they were changed):
KEY_LEFT 37
KEY_UP 38
KEY_RIGHT 39
KEY_DOWN 40