cocoa: if closewindow button (red-x) is pressed, cancel color selection, instead of accepting the color

git-svn-id: trunk@62710 -
This commit is contained in:
dmitry 2020-03-08 05:33:20 +00:00
parent 45ac9380f3
commit 04ca721bfc

View File

@ -92,7 +92,7 @@ type
public
colorPanel: NSColorPanel;
ColorDialog: TColorDialog;
DontPickColorOnClose: Boolean;
didPickColor: Boolean;
// NSWindowDelegateProtocol
procedure windowWillClose(notification: NSNotification); message 'windowWillClose:';
//
@ -621,7 +621,7 @@ end;
procedure TColorPanelDelegate.windowWillClose(notification: NSNotification);
begin
if not DontPickColorOnClose then
if didPickColor then
begin
ColorDialog.UserChoice := mrOk;
doPickColor();
@ -637,15 +637,13 @@ end;
procedure TColorPanelDelegate.pickColor();
begin
ColorDialog.UserChoice := mrCancel;
DontPickColorOnClose := True;
didPickColor := True;
doPickColor();
exit();
end;
procedure TColorPanelDelegate.exit();
begin
ColorDialog.UserChoice := mrOk;
DontPickColorOnClose := True;
colorPanel.close();
end;