mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-26 15:00:26 +02:00
LCL: TMenuItem.Click: do not call OnClick if Action.OnExecute=OnClick, call Action.Execute always on click
git-svn-id: trunk@41683 -
This commit is contained in:
parent
4a1f602815
commit
b63a49d5ea
@ -60,6 +60,8 @@ procedure TMenuItem.Click;
|
||||
Result:=CompareMethods(TMethod(FOnClick),TMethod(Action.OnExecute));
|
||||
end;
|
||||
|
||||
var
|
||||
CallAction: Boolean;
|
||||
begin
|
||||
if Enabled then
|
||||
begin
|
||||
@ -75,13 +77,14 @@ begin
|
||||
Checked := not Checked;
|
||||
end;
|
||||
|
||||
// first call our OnClick
|
||||
if Assigned(FOnClick) then
|
||||
CallAction:=(not (csDesigning in ComponentState)) and (ActionLink <> nil);
|
||||
// first call our own OnClick if it differs from Action.OnExecute
|
||||
if Assigned(FOnClick)
|
||||
and ((not CallAction) or (not OnClickIsActionExecute)) then
|
||||
FOnClick(Self);
|
||||
// then trigger the Action
|
||||
if not (csDesigning in ComponentState) and (ActionLink <> nil)
|
||||
and not OnClickIsActionExecute then
|
||||
FActionLink.Execute(Self);
|
||||
if CallAction then
|
||||
ActionLink.Execute(Self);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user