From 5d511d9b6eff54491283dbcff44734d4b76c858d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 22 Mar 2007 02:46:21 +0000 Subject: [PATCH] don't lose the combobox text when it's opened and closed (patch 1684252, closes bug 1612994) [backport from HEAD] git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@45011 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/msw/choice.cpp | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/docs/changes.txt b/docs/changes.txt index c80ebf9533..c5028ee352 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -94,6 +94,7 @@ wxMSW: - Corrected wxStaticBox label appearance when its foreground colour was set: it didn't respect font size nor background colour then (Juan Antonio Ortega) +- Don't lose combobox text when it's opened and closed (Kolya Kosenko) 2.8.3 ----- diff --git a/src/msw/choice.cpp b/src/msw/choice.cpp index 8fc25f779d..63c8c66967 100644 --- a/src/msw/choice.cpp +++ b/src/msw/choice.cpp @@ -720,6 +720,13 @@ bool wxChoice::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) // need to reset the selection back to it if it's eventually // cancelled by user m_lastAcceptedSelection = GetCurrentSelection(); + if ( m_lastAcceptedSelection == -1 ) + { + // no current selection so no need to restore it later (this + // happens when opening a combobox containing text not from its + // list of items and we shouldn't erase this text) + m_lastAcceptedSelection = wxID_NONE; + } break; case CBN_CLOSEUP: