LazControls: Revert the earlier change in TCustomCheckBoxThemed, issue #39425.

This commit is contained in:
Juha 2021-10-12 16:47:56 +03:00
parent 232ed8531c
commit 51cdd4d4c4

View File

@ -467,12 +467,14 @@ begin
if [csLoading, csDestroying, csDesigning]*ComponentState = [] then begin if [csLoading, csDestroying, csDesigning]*ComponentState = [] then begin
if Assigned(OnEditingDone) then OnEditingDone(self); if Assigned(OnEditingDone) then OnEditingDone(self);
if Assigned(OnChange) then OnChange(self); if Assigned(OnChange) then OnChange(self);
{ Execute only when Action.Checked is changed } // Execute only when Action.Checked is changed
if not CheckFromAction then begin if not CheckFromAction then begin
if Assigned(OnClick) and not Assigned(Action) then // Call OnClick only if its handler differs from the Action's handler.
OnClick(self); if Assigned(OnClick) and
if (Action is TCustomAction) and not (Assigned(Action) and SameMethod(TMethod(Action.OnExecute),TMethod(OnClick)))
(TCustomAction(Action).Checked <> (AValue = cbChecked)) then OnClick(self);
// Then the action
if (Action is TCustomAction) and (TCustomAction(Action).Checked<>(AValue=cbChecked))
then ActionLink.Execute(self); then ActionLink.Execute(self);
end; end;
end; end;