On 01/10/2011 07:53, Mattias Gaertner wrote:
On Sat, 01 Oct 2011 03:04:56 +0200
Hans-Peter Diettrich<[email protected]> 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;
Maybe I overlook something, but
@FOnClick is the address of the variable holding the method reference
(or nil)
so is @Action.OnExecute
So when can they ever be equal?
Should that maybe compare FOnClick <> Action.OnExecute ?
Also is that supposed to be a shortcut, saving the call, or is that
indeed supposed to modify behaviour?
Even if the 2 callbacks are pointing to the same method, calling
Action.OnExecute, will call the callback with Sender=TheAction, while
FOnClick gets the current object.
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus