Recent

Author Topic: Values of the keys in OnKeyDown  (Read 13066 times)

T-bear

  • Full Member
  • ***
  • Posts: 160
Values of the keys in OnKeyDown
« on: April 04, 2011, 11:42:00 am »
Whats the value of the keybordbuttons 1, 2, 3 ..., and is there a list with those values for every button on the keybord?

Thanks!  :D

Blaazen

  • Hero Member
  • *****
  • Posts: 2782
  • POKE 54296,15
    • Eye-Candy Controls
Re: Values of the keys in OnKeyDown
« Reply #1 on: April 04, 2011, 01:02:56 pm »
Just simply try it.  :)

Make New Project and OnKeyDown event of Form1 put this code:
Code: [Select]
Caption:=inttostr(Key);

Lazarus 2.1.0 r61214:62238 FPC 3.3.1 r40507 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

Zoran

  • Hero Member
  • *****
  • Posts: 1558
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Values of the keys in OnKeyDown
« Reply #2 on: April 04, 2011, 02:01:42 pm »
You can use virtual key codes defined by microsoft, see here: http://msdn.microsoft.com/en-us/library/ms645540
or
http://msdn.microsoft.com/en-us/library/dd375731%28VS.85%29.aspx

Plus, for letters and number keys in lazarus you can also use VK_1, VK_2, ... VK_A, VK_B, ...

All these constants are found in LCLType unit, see and find their declarations there.
« Last Edit: April 05, 2011, 09:10:44 pm by Zoran »

 

TinyPortal © 2005-2018