Merge branch 'combo-event'

Fix bug with string field not being set in wxOwnerDrawnComboBox events.

See https://github.com/wxWidgets/wxWidgets/pull/1436
This commit is contained in:
Vadim Zeitlin
2019-07-22 18:48:20 +02:00
2 changed files with 7 additions and 1 deletions

View File

@@ -299,7 +299,6 @@ void wxControlWithItemsBase::SendSelectionChangedEvent(wxEventType eventType)
wxCommandEvent event(eventType, m_windowId); wxCommandEvent event(eventType, m_windowId);
event.SetInt(n); event.SetInt(n);
event.SetEventObject(this);
event.SetString(GetStringSelection()); event.SetString(GetStringSelection());
InitCommandEventWithItems(event, n); InitCommandEventWithItems(event, n);

View File

@@ -233,11 +233,18 @@ void wxVListBoxComboPopup::DismissWithEvent()
void wxVListBoxComboPopup::SendComboBoxEvent( int selection ) void wxVListBoxComboPopup::SendComboBoxEvent( int selection )
{ {
// TODO: wxVListBox should be refactored to inherit from wxItemContainer
// and then we would be able to just call SendSelectionChangedEvent()
// (which, itself, should be moved down to wxItemContainer from
// wxControlWithItemsBase) instead of duplicating its code.
wxCommandEvent evt(wxEVT_COMBOBOX,m_combo->GetId()); wxCommandEvent evt(wxEVT_COMBOBOX,m_combo->GetId());
evt.SetEventObject(m_combo); evt.SetEventObject(m_combo);
evt.SetInt(selection); evt.SetInt(selection);
if ( selection != wxNOT_FOUND )
evt.SetString(m_strings[selection]);
// Set client data, if any // Set client data, if any
if ( selection >= 0 && (int)m_clientDatas.size() > selection ) if ( selection >= 0 && (int)m_clientDatas.size() > selection )