cocoa: Redesigns the blocking of events during modal to use lclIsEnabled

git-svn-id: trunk@49815 -
This commit is contained in:
sekelsenmat 2015-09-11 05:16:36 +00:00
parent 5c6d68e163
commit b690381ab0
2 changed files with 4 additions and 2 deletions

View File

@ -1640,8 +1640,6 @@ end;
procedure TCocoaButton.actionButtonClick(sender: NSObject);
begin
if CocoaWidgetSet.IsControlDisabledDueToModal(Self) then Exit;
// this is the action handler of button
if Assigned(callback) then
callback.ButtonClick;
@ -2276,6 +2274,7 @@ end;
function LCLControlExtension.lclIsEnabled:Boolean;
begin
Result := IsEnabled;
if Result and CocoaWidgetSet.IsControlDisabledDueToModal(Self) then Result := False;
end;
procedure LCLControlExtension.lclSetEnabled(AEnabled:Boolean);

View File

@ -320,6 +320,7 @@ procedure TLCLRadioButtonCallback.ButtonClick;
var
SubView: NSView;
begin
if not Owner.lclIsEnabled() then Exit;
if NSButton(Owner).state = NSOnState then
begin
for SubView in NSButton(Owner).superView.subviews do
@ -333,6 +334,7 @@ end;
procedure TLCLButtonCallback.ButtonClick;
begin
if not Owner.lclIsEnabled() then Exit;
SendSimpleMessage(Target, LM_CLICKED);
end;
@ -348,6 +350,7 @@ end;
procedure TLCLCheckBoxCallback.ButtonClick;
begin
inherited;
if not Owner.lclIsEnabled() then Exit;
SendSimpleMessage(Target, LM_CHANGED);
// todo: win32 has something about dbcheckbox handling here. so maybe we need to handle it special too
end;