LCL: setting Action.OnExecute no longer changes the TControl.OnClick, bug

git-svn-id: trunk@41415 -
This commit is contained in:
mattias 2013-05-26 12:36:40 +00:00
parent dfdab62ac2
commit 66a30a311c
3 changed files with 8 additions and 17 deletions

View File

@ -1145,7 +1145,6 @@ type
function IsHintStored: Boolean;
function IsHelpContextStored: Boolean;
function IsHelpKeyWordStored: boolean;
function IsOnClickStored: Boolean;
function IsShowHintStored: Boolean;
function IsVisibleStored: Boolean;
procedure DoBeforeMouseMessage;
@ -1595,7 +1594,7 @@ type
property IsControl: Boolean read FIsControl write FIsControl;
property MouseEntered: Boolean read FMouseEntered;
property OnChangeBounds: TNotifyEvent read FOnChangeBounds write FOnChangeBounds;
property OnClick: TNotifyEvent read FOnClick write FOnClick stored IsOnClickStored;
property OnClick: TNotifyEvent read FOnClick write FOnClick;
property OnResize: TNotifyEvent read FOnResize write FOnResize;
property OnShowHint: TControlShowHintEvent read FOnShowHint write FOnShowHint;
property Parent: TWinControl read FParent write SetParent;

View File

@ -899,11 +899,6 @@ begin
Result := (ActionLink = nil) or not ActionLink.IsHelpLinked;
end;
function TControl.IsOnClickStored: Boolean;
begin
Result := (ActionLink = nil) or not ActionLink.IsOnExecuteLinked;
end;
function TControl.IsShowHintStored: Boolean;
begin
Result := not ParentShowHint;
@ -1855,8 +1850,6 @@ begin
Hint := NewAction.Hint;
if not CheckDefaults or Visible then
Visible := NewAction.Visible;
if not CheckDefaults or not Assigned(OnClick) then
OnClick := NewAction.OnExecute;
if not CheckDefaults or (Self.HelpContext = 0) then
Self.HelpContext := HelpContext;
if not CheckDefaults or (Self.HelpKeyword = '') then
@ -2702,14 +2695,12 @@ end;
procedure TControl.Click;
begin
//DebugLn(['TControl.Click ',DbgSName(Self)]);
if Assigned(FOnClick) and (Action<>nil)
and (not CompareMethods(TMethod(Action.OnExecute),TMethod(FOnClick))) then
// the OnClick is set and differs from the Action => call the OnClick
FOnClick(Self)
else if (not (csDesigning in ComponentState)) and (ActionLink <> nil) then
ActionLink.Execute(Self)
else if Assigned(FOnClick) then
// first call our own OnClick
if Assigned(FOnClick) then
FOnClick(Self);
// then trigger the Action
if (not (csDesigning in ComponentState)) and (ActionLink <> nil) then
ActionLink.Execute(Self);
end;
{------------------------------------------------------------------------------

View File

@ -84,7 +84,8 @@ end;
procedure TControlActionLink.SetOnExecute(Value: TNotifyEvent);
begin
if IsOnExecuteLinked then FClient.OnClick := Value;
// Note: formerly this changed FClient.OnClick, but that is unneeded, because
// TControl.Click executes Action
end;
function TControlActionLink.IsHelpLinked: Boolean;