[lazarus] Context sensitive help

Mattias Gaertner nc-gaertnma at netcologne.de
Sun Apr 20 03:22:41 EDT 2003


On Sat, 19 Apr 2003 23:23:24 +0200
Tony Maro <tony at maro.net> wrote:

> Mattias Gaertner wrote:
> 
> >I think, an application wide KeyDown event would be very useful. Not only
> >for a helpsystem. I have added a handler chain to Application.
> >Just add your keydown event with:
> >
> >Application.AddOnKeyDownHandler(@AppKeyDown);
> >
> >This keydown is invoked, if no other component used the key
> >(Key<>VK_Unknown).
> >
> >  
> >
> I've been playing around with this event, and found that it is called 
> twice for each keypress.

Once for the form, and once for the TEdit. Normal.


> Once the Sender object is some blank object that claims it is a 
> TWinControl (at least a descendant of) but has no name in the name 
> property, and then a second time for the actual object that has focus.
> 
> I never could figure out what the first object sent to the event was... 
> a few if (Sender is XXXX) let me know that it's at least a TWinControl 
> descendant, but it wasn't the TEdit control that I was hitting the key 
> in, because when compared as (Sender is TEdit) it wasn't...

You can find out the class with writeln(Sender.ClassName);

 
> And like I said the name property of the object in the first call is
> blank.

You found a bug. The form name was not loaded. I fixed that.


Mattias






More information about the Lazarus mailing list