Added check for sel == -1
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4335 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
9ac6ff7b80
commit
8c1c5302f3
@ -620,7 +620,6 @@ int wxEntry(WXHINSTANCE hInstance,
|
||||
#else
|
||||
#undef CATCH_PROGRAM_EXCEPTIONS
|
||||
#endif
|
||||
|
||||
wxhInstance = (HINSTANCE) hInstance;
|
||||
|
||||
if (!wxApp::Initialize())
|
||||
|
@ -318,15 +318,18 @@ bool wxChoice::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
|
||||
}
|
||||
|
||||
int n = GetSelection();
|
||||
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, m_windowId);
|
||||
event.SetInt(n);
|
||||
event.SetEventObject(this);
|
||||
event.SetString(GetStringSelection());
|
||||
if ( HasClientObjectData() )
|
||||
event.SetClientObject( GetClientObject(n) );
|
||||
else if ( HasClientUntypedData() )
|
||||
event.SetClientData( GetClientData(n) );
|
||||
ProcessCommand(event);
|
||||
if (n > -1)
|
||||
{
|
||||
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, m_windowId);
|
||||
event.SetInt(n);
|
||||
event.SetEventObject(this);
|
||||
event.SetString(GetStringSelection());
|
||||
if ( HasClientObjectData() )
|
||||
event.SetClientObject( GetClientObject(n) );
|
||||
else if ( HasClientUntypedData() )
|
||||
event.SetClientData( GetClientData(n) );
|
||||
ProcessCommand(event);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -38,11 +38,14 @@ bool wxComboBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
|
||||
{
|
||||
if (param == CBN_SELCHANGE)
|
||||
{
|
||||
wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, m_windowId);
|
||||
event.SetInt(GetSelection());
|
||||
event.SetEventObject(this);
|
||||
event.SetString(GetStringSelection());
|
||||
ProcessCommand(event);
|
||||
if (GetSelection() > -1)
|
||||
{
|
||||
wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, m_windowId);
|
||||
event.SetInt(GetSelection());
|
||||
event.SetEventObject(this);
|
||||
event.SetString(GetStringSelection());
|
||||
ProcessCommand(event);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user