From 1b4a7cd671500dfda973d656b9a9f51fe8ce3096 Mon Sep 17 00:00:00 2001 From: John Roberts Date: Sat, 18 Jul 2015 01:19:18 +0200 Subject: [PATCH] Fix handling of "Cancel" button in wxSearchCtrl under OS X. Pressing it results in a control action with an empty, but not null, string. Recognize it correctly. Closes #16869. (this is a backport of 7065e26fb3a6eb698e49e4aaf911b0656f466efd from master) --- docs/changes.txt | 1 + src/osx/cocoa/srchctrl.mm | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/changes.txt b/docs/changes.txt index 29b83430d1..fd70022aac 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -637,6 +637,7 @@ wxOSX: - Fix using wxHTTP and wxFTP from worker thread. - Fix wxFileDialog::GetFilterIndex() for file open dialogs (phsilva). - Fix wxSearchCtrl appearance under 10.10 (John Roberts). +- Fix handling of "Cancel" button in wxSearchCtrl (John Roberts). - Generate correct events for WXK_NUMPAD_ENTER (John Roberts). - Fix handling of WXK_NUMPAD_ENTER in wxTextCtrl (John Roberts). - Send wxIconizeEvent when a window is iconized/restore (Rob Krakora). diff --git a/src/osx/cocoa/srchctrl.mm b/src/osx/cocoa/srchctrl.mm index 2525391bef..8549d8d944 100644 --- a/src/osx/cocoa/srchctrl.mm +++ b/src/osx/cocoa/srchctrl.mm @@ -155,7 +155,7 @@ public : if ( wxpeer ) { NSString *searchString = [m_searchField stringValue]; - if ( searchString == nil ) + if ( searchString == nil || !searchString.length ) { wxpeer->HandleSearchFieldCancelHit(); }