Recent

Author Topic: [SOLVED] Is form onKeyDown implemented in Cocoa  (Read 1560 times)

AL

  • Sr. Member
  • ****
  • Posts: 264
[SOLVED] Is form onKeyDown implemented in Cocoa
« on: March 10, 2020, 03:16:56 am »
I have the following code that works in Windows but not in Cocoa

procedure TMainForm.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState  );
begin
   If Key = VK_Space then StartBtn.click ;
end;                                                   

The event does not seem to be called in Cocoa.  Should I use something different?
« Last Edit: March 10, 2020, 03:22:52 pm by AL »
Laz 3.1, fpc 3.2.2, Win10
Laz 3.1  fpc 3.2.2, MacOS Monterey running on VMWare/Win 10
Laz 3.1  fpc 3.2.2 Ubuntu 20.04

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Is form onKeyDown implemented in Cocoa
« Reply #1 on: March 10, 2020, 03:41:13 am »
works fine here (lazarus 2.1.0).
try to set Form.KeyPreview to true.

AL

  • Sr. Member
  • ****
  • Posts: 264
Re: Is form onKeyDown implemented in Cocoa
« Reply #2 on: March 10, 2020, 03:22:10 pm »
That did it! Thank you.  Problem Solved
Laz 3.1, fpc 3.2.2, Win10
Laz 3.1  fpc 3.2.2, MacOS Monterey running on VMWare/Win 10
Laz 3.1  fpc 3.2.2 Ubuntu 20.04

 

TinyPortal © 2005-2018