From 3adc70bf87dadbf974cea492d1c6275fcafbec9c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 11 Nov 2001 19:19:59 +0000 Subject: [PATCH] fixed minor combobox bug: GetValue() reported wrong value when caleld from TEXT_UPDATED handler git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12379 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/combobox.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/msw/combobox.cpp b/src/msw/combobox.cpp index c5368a57d1..470a02654c 100644 --- a/src/msw/combobox.cpp +++ b/src/msw/combobox.cpp @@ -231,11 +231,22 @@ bool wxComboBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) case CBN_EDITCHANGE: { wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, GetId()); + // if sel != -1, value was initialized above (and we can't use // GetValue() here as it would return the old selection and we // want the new one) if ( sel == -1 ) + { value = GetValue(); + } + else // we're synthesizing text updated event from sel change + { + // we need to do this because the user code expects + // wxComboBox::GetValue() to return the new value from + // "text updated" handler but it hadn't been updated yet + SetValue(value); + } + event.SetString(value); event.SetEventObject(this); ProcessCommand(event); -- 2.49.0