Recent

Author Topic: Virtual key codes to mac conversion  (Read 599 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 2140
    • Lazarus and Free Pascal italian community
Virtual key codes to mac conversion
« on: December 16, 2019, 04:56:31 pm »
Hi guys, is there a function that changes from virtual key codes to codes for mac os cocoa? Example

Code: Pascal  [Select][+][-]
  1.   VK_Q         : Result := 12;
  2.   VK_W         : Result := 13;
  3.   VK_E         : Result := 14;
  4.   VK_R         : Result := 15;
  5.   VK_T         : Result := 17;
  6.   VK_Y         : Result := 16;
  7.   VK_U         : Result := 32;
  8.   VK_I         : Result := 34;
  9.   VK_O         : Result := 31;
  10.   VK_P         : Result := 35;
  11.   VK_A         : Result := 0;
  12.   VK_S         : Result := 1;
  13.   VK_D         : Result := 2;
  14.   VK_F         : Result := 3;
  15.   VK_G         : Result := 5;
  16.   VK_H         : Result := 4;
  17.   VK_J         : Result := 38;
  18.   VK_K         : Result := 40;
  19.   VK_L         : Result := 37;
  20.   VK_Z         : Result := 6;
  21.   VK_X         : Result := 7;
  22.   VK_C         : Result := 8;
  23.   VK_V         : Result := 9;
  24.   VK_B         : Result := 11;
  25.   VK_N         : Result := 45;
  26.   VK_M         : Result := 46;
  27.  
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2532
    • havefunsoft.com
Re: Virtual key codes to mac conversion
« Reply #1 on: December 16, 2019, 05:33:47 pm »
not really.
but all you need is to reverse MacCodeToVK() (from cocoautils.pas)
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

 

TinyPortal © 2005-2018