Skip to main content

Does getKeyChar method trap directional keys?

Please note these forums are being decommissioned and use the new and improved forums at
1 reply [Last post]
Joined: 2012-08-15
Points: 0

Hello, is there any substitute of virtual key codes like VK_UP,VK_DOWN,etc ?

Actually i want to use getKeyChar() method to trap the directional keys(up,down,left,right) but it seems only getKeyCode() is getting it done for me for which i have to use the virtual key codes.

Doesn't getKeyChar() traps directional keys?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2012-08-20
Points: 0

getKeyCode() returns a numerical number that identifies which key. getKeyChar() returns the character typed. Since the directional keys do not type any character, getKeyChar() returns nothing when they are pressed. As a result, getKeyChar() cannot be used to find the directional keys.

So the simple answer is: No. getKeyChar() always returns nothing for the directional keys.