Lazarus

Free Pascal => FPC development => Topic started by: lazer on October 10, 2017, 11:58:55 am

Title: VK_F1 and KeyDown
Post by: lazer on October 10, 2017, 11:58:55 am
Hi,

I wanted to catch the F1 key to show a quick version message.  I expected to do this by trapping VK_F1 in a KeyDown event.

Firstly any key constants like VK_SPACE and VK_F1  seem undefined. Aren't these defined in LCL somewhere?

Secondly, the keydown event is not happening. My recollection was that any key not serviced by a window will get passed back to its parent until it gets to the top level ( the "form" ) window.

I have a bunch of TEdits  in a Tgroupbox in Tpanel on a form.  Am I correct in thinking F1 will bubble up to the form?

TIA.
Title: Re: VK_F1 and KeyDown
Post by: Cyrax on October 10, 2017, 12:10:33 pm
Add LCLType unit in to your uses clause.
Title: Re: VK_F1 and KeyDown
Post by: howardpc on October 10, 2017, 01:00:27 pm
Secondly, the keydown event is not happening.
I have a bunch of TEdits  in a Tgroupbox in Tpanel on a form.  Am I correct in thinking F1 will bubble up to the form?

Do you mean that your Edit1 has focus, and an Edit1KeyDown event is not called when you press F1?
Edit keydown events work as expected here.
Perhaps you need to share compilable code that illustrates the problem you have.
Title: Re: VK_F1 and KeyDown
Post by: lazer on October 10, 2017, 09:16:49 pm
Add LCLType unit in to your uses clause.

Many thanks, that is what  was looking for.
Title: Re: VK_F1 and KeyDown
Post by: lazer on October 11, 2017, 07:58:25 am
Secondly, the keydown event is not happening.
I have a bunch of TEdits  in a Tgroupbox in Tpanel on a form.  Am I correct in thinking F1 will bubble up to the form?

Do you mean that your Edit1 has focus, and an Edit1KeyDown event is not called when you press F1?
Edit keydown events work as expected here.
Perhaps you need to share compilable code that illustrates the problem you have.
TinyPortal © 2005-2018