Recent

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

AL

  • Full Member
  • ***
  • Posts: 181
[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 2.1.0, fpc 3.3.1, Win10
Laz 2.1.0, fpc 3.3.1, Mac OS Mojave running on VMWare
Laz 2.1.0  fpc 3.3.1 Ubuntu 20.04

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2514
    • 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.
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

AL

  • Full Member
  • ***
  • Posts: 181
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 2.1.0, fpc 3.3.1, Win10
Laz 2.1.0, fpc 3.3.1, Mac OS Mojave running on VMWare
Laz 2.1.0  fpc 3.3.1 Ubuntu 20.04

 

TinyPortal © 2005-2018