Forum > LCL

[Solved] Cannot detect key[Down|Press|Up] activity in Lazarus on MacOS X 11-14

(1/4) > >>

BradleySlavik:
Running Lazarus on MacOS 11 and 14 (two different machines).

Using simple Pong program from user Handoko.

I have opened Form with Object Inspector and set KeyPreview to True.
This added the line:
   KeyPreview:=True;
to the TForm1.FormCreate procedure. Hurrah!

Added declarations and definitions for TForm1.FormKey[Down|Press|Create]
Just trying to detect keypress in the most basic fashion.
Started with body of ShowMessage('Key Down!') and no filtering to see if code was run.
Even tried WriteLn('Key Up!').
But none of these procedures, in spite no logic, seem to reach the procedures.
Clearly I am not understanding something very basic.
I would certainly appreciate any insight on where to add debugging code or which pages to read under LCL or other library that I have failed to understand.

The program works perfectly under Windows 10.
I am happy to dig into Lazarus to fix the underlying code so it works on MacOS, but I sure would appreciate some pointers as to where to start digging.

I have been reading about LCLIntf, and that looks like a good place to start.

Any thoughts?


jamie:
doing that in the OBJECT inspector should have not added anything in the OnCreate/FormCreate event.

Look at the YourPRoject.LFM file so see how things are setup.

Jamie

dseligo:
Try this: go to Menu/Project Options, Application, and then you have button Create Application Bundle.

BradleySlavik:

--- Quote from: jamie on November 24, 2024, 01:24:54 am ---doing that in the OBJECT inspector should have not added anything in the OnCreate/FormCreate event.

Look at the YourPRoject.LFM file so see how things are setup.

--- End quote ---

Great! I look in there. It says KeyPreview = True

BradleySlavik:

--- Quote from: dseligo on November 24, 2024, 01:26:07 am ---Try this: go to Menu/Project Options, Application, and then you have button Create Application Bundle.

--- End quote ---

It says "The Application Bundle was created for "Pathname_to_project"

Running program still does not detect key presses.
Pressing ordinary keys does not make any noise.
If I press arrow keys, the computer makes clicking/popping noise. So something knows they are being pushed, but not letting the program under Lazarus receive them.

I have bluetooth keyboard. I tried plugging it in but that changes nothing. These are Intel Macs. Not the new Apple silicon ones.

Thanks for telling me about the Project options section. I will start looking through that.

Navigation

[0] Message Index

[#] Next page

Go to full version