Add wxControlWithItems::SendSelectionChangedEvent() helper.

Reuse the same event generation code for wxChoice in wxMSW, wxGTK and wxOSX
and also wxComboBox in wxMSW and wxGTK instead of duplicating it (incompletely
and so partially incorrectly in wxOSX case).

This is just a refactoring so no changes in behaviour.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73102 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-12-02 23:48:59 +00:00
parent 4d3845c073
commit 7bc740719c
6 changed files with 26 additions and 57 deletions

View File

@@ -311,16 +311,9 @@ bool wxComboBox::MSWCommand(WXUINT param, WXWORD id)
// could get a wrong value when it calls our GetValue()
::SetWindowText(GetHwnd(), value.t_str());
{
wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, GetId());
event.SetInt(sel);
event.SetString(value);
InitCommandEventWithItems(event, sel);
SendSelectionChangedEvent(wxEVT_COMMAND_COMBOBOX_SELECTED);
ProcessCommand(event);
}
// fall through: for compability with wxGTK, also send the text
// fall through: for compatibility with wxGTK, also send the text
// update event when the selection changes (this also seems more
// logical as the text does change)