[Lazarus] TControl.Click?

Mattias Gaertner nc-gaertnma at netcologne.de
Sat Oct 1 14:54:48 CEST 2011


On Sat, 01 Oct 2011 15:07:01 +0200
Hans-Peter Diettrich <DrDiettrich1 at aol.com> wrote:

> Mattias Gaertner schrieb:
> > On Sat, 01 Oct 2011 03:04:56 +0200
> > Hans-Peter Diettrich <DrDiettrich1 at aol.com> wrote:
> > 
> >> I don't understand the logic behind TControl.Click:
> >>
> >> procedure TControl.Click;
> >> begin
> >>    //DebugLn(['TControl.Click ',DbgSName(Self)]);
> >>    if (not (csDesigning in ComponentState)) and (ActionLink <> nil) and
> >>       ((Action=nil) or (@FOnClick <> @Action.OnExecute) or 
> >> Assigned(FOnClick)) then
> >>      ActionLink.Execute(Self)
> >>    else
> >>    if Assigned(FOnClick) then
> >>      FOnClick(Self);
> >> end;
> >>
> >> This IMO will invoke ActionLink.Execute if (a different) FOnClick is 
> >> assigned - so far okay. But FOnClick will *not* be invoked then (even if 
> >> different), and it will be invoked *always* in design state.
> >>
> >> Is it really okay to invoke an user-supplied OnClick handler in design 
> >> state?
> > 
> > No.
> 
> Then the question remains, why Action hides the OnClick handler, at 
> runtime? Is this required by Delphi compatibility?

Yes.
 
>[...]

Mattias




More information about the Lazarus mailing list