added InitCommandEventWithItems() and call it from wxChoice and wxComboBox code to ensure that per item client data is set correctly in the generated events (replaces patch 1476171; closes bug 1470505)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39077 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2006-05-06 19:05:50 +00:00
parent 168a76fe3d
commit 4c15a37592

View File

@ -172,6 +172,23 @@ void *wxItemContainer::GetClientData(unsigned int n) const
return DoGetItemClientData(n);
}
// ============================================================================
// wxControlWithItems implementation
// ============================================================================
void wxControlWithItems::InitCommandEventWithItems(wxCommandEvent& event, int n)
{
InitCommandEvent(event);
if ( n != wxNOT_FOUND )
{
if ( HasClientObjectData() )
event.SetClientObject(GetClientObject(n));
else if ( HasClientUntypedData() )
event.SetClientData(GetClientData(n));
}
}
wxControlWithItems::~wxControlWithItems()
{
// this destructor is required for Darwin