From 89ecd814604ddfb47b9bdde1ae01b20f45ec969b Mon Sep 17 00:00:00 2001 From: mrX Date: Sun, 10 Jun 2018 23:33:10 +0200 Subject: [PATCH] Don't change wxTextCtrl colour automatically under macOS When wxColourDialog is shown, any changes to the colour selected in it apparently result in broadcast messages to all currently visible text controls, which was unexpected. Block the changeColor: message to prevent this from happening. Closes https://github.com/wxWidgets/wxWidgets/pull/830 --- include/wx/osx/cocoa/private.h | 1 + src/osx/cocoa/textctrl.mm | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/include/wx/osx/cocoa/private.h b/include/wx/osx/cocoa/private.h index 73b93b4c86..694dc97ece 100644 --- a/include/wx/osx/cocoa/private.h +++ b/include/wx/osx/cocoa/private.h @@ -379,6 +379,7 @@ public: } - (void)textDidChange:(NSNotification *)aNotification; + - (void)changeColor:(id)sender; @end diff --git a/src/osx/cocoa/textctrl.mm b/src/osx/cocoa/textctrl.mm index 590815b108..18aa408e72 100644 --- a/src/osx/cocoa/textctrl.mm +++ b/src/osx/cocoa/textctrl.mm @@ -436,6 +436,15 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil; impl->controlTextDidChange(); } + +- (void)changeColor:(id)sender +{ + // Define this just to block the color change messages - these are sent from + // the shared color/font panel resulting in unwanted changes of color when + // shared color panel is used (as when using wxColourPickerCtrl for example). +} + + - (void) setEnabled:(BOOL) flag { // from Technical Q&A QA1461