* * *

Author Topic: VK_F1 and KeyDown  (Read 431 times)

lazer

  • New member
  • *
  • Posts: 25
VK_F1 and KeyDown
« 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.

Cyrax

  • Hero Member
  • *****
  • Posts: 550
Re: VK_F1 and KeyDown
« Reply #1 on: October 10, 2017, 12:10:33 pm »
Add LCLType unit in to your uses clause.

howardpc

  • Hero Member
  • *****
  • Posts: 2421
Re: VK_F1 and KeyDown
« Reply #2 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.

lazer

  • New member
  • *
  • Posts: 25
Re: VK_F1 and KeyDown
« Reply #3 on: October 10, 2017, 09:16:49 pm »
Add LCLType unit in to your uses clause.

Many thanks, that is what  was looking for.

lazer

  • New member
  • *
  • Posts: 25
Re: VK_F1 and KeyDown
« Reply #4 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.

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus