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:
@@ -292,4 +292,19 @@ wxControlWithItemsBase::InitCommandEventWithItems(wxCommandEvent& event, int n)
|
||||
}
|
||||
}
|
||||
|
||||
void wxControlWithItemsBase::SendSelectionChangedEvent(wxEventType eventType)
|
||||
{
|
||||
const int n = GetSelection();
|
||||
if ( n == wxNOT_FOUND )
|
||||
return;
|
||||
|
||||
wxCommandEvent event(eventType, m_windowId);
|
||||
event.SetInt(n);
|
||||
event.SetEventObject(this);
|
||||
event.SetString(GetStringSelection());
|
||||
InitCommandEventWithItems(event, n);
|
||||
|
||||
HandleWindowEvent(event);
|
||||
}
|
||||
|
||||
#endif // wxUSE_CONTROLS
|
||||
|
||||
Reference in New Issue
Block a user