Martin schrieb:

further more:

ActionLink.Execute is virtual

So comparing with the OnExecute method pointer is at the very least insufficient.

If ActionLink.Execute  is overridden, it could call/do anything.

I would suggest to drop that check entirely

Delphi compares
  DelegatesEqual(@FClient.OnClick, @Action.OnExecute)));
what looks good, except that DelegatesEqual accepts two Pointers - what causes the well known comparison problems.

At least FOnClick is preferred over Execute:

procedure TControl.Click;
begin
{ Call OnClick if assigned and not equal to associated action's OnExecute.
    If associated action's OnExecute assigned then call it, otherwise, call
    OnClick. }
if Assigned(FOnClick) and (Action <> nil) and not DelegatesEqual(@FOnClick, @Action.OnExecute) then
    FOnClick(Self)
  else if not (csDesigning in ComponentState) and (ActionLink <> nil) then
    ActionLink.Execute(Self)
  else if Assigned(FOnClick) then
    FOnClick(Self);
end;

DoDi


--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to