Can\'t get state of arrow keys

Discussions about product bugs & problems!
Note: This is no replacement for the Official ETM Support!
Search

Post Reply
4 posts • Page 1 of 1
Dmytro_Komsheliuk
Posts: 9
Joined: Tue Dec 22, 2015 11:13 am

Can\'t get state of arrow keys

Post by Dmytro_Komsheliuk »

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

User avatar
mkoller
Posts: 741
Joined: Fri Sep 17, 2010 9:03 am

Re: Can\'t get state of arrow keys

Post by mkoller »

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.

Dmytro_Komsheliuk
Posts: 9
Joined: Tue Dec 22, 2015 11:13 am

Re: Can\'t get state of arrow keys

Post by Dmytro_Komsheliuk »

Thanks :) hope it will be fixed in next version

User avatar
mkoller
Posts: 741
Joined: Fri Sep 17, 2010 9:03 am

Re: Can\'t get state of arrow keys

Post by mkoller »

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

Post Reply
4 posts • Page 1 of 1