It was possible to hide the main part of a combobox control but keep its popup
shown and this notably happened in wxGrid when TAB was pressed while a
wxChoice cell editor was dropped down.
Avoid this Cheshire combobox syndrome by explicitly dismissing the popup when
a combobox is hidden.
Closes #3113.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71104
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxChoiceNameStr);
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxChoiceNameStr);
+ virtual bool Show(bool show = true);
+
virtual void SetLabel(const wxString& label);
virtual unsigned int GetCount() const;
virtual void SetLabel(const wxString& label);
virtual unsigned int GetCount() const;
::SendMessage(GetHwnd(), CB_SHOWDROPDOWN, show, 0);
}
::SendMessage(GetHwnd(), CB_SHOWDROPDOWN, show, 0);
}
+bool wxChoice::Show(bool show)
+{
+ if ( !wxChoiceBase::Show(show) )
+ return false;
+
+ // When hiding the combobox, we also need to hide its popup part as it
+ // doesn't happen automatically.
+ if ( !show && ::SendMessage(GetHwnd(), CB_GETDROPPEDSTATE, 0, 0) )
+ MSWDoPopupOrDismiss(false);
+
+ return true;
+}
+
// ----------------------------------------------------------------------------
// MSW message handlers
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// MSW message handlers
// ----------------------------------------------------------------------------