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:
Julian Smart 1999-11-03 10:08:03 +00:00
parent 9ac6ff7b80
commit 8c1c5302f3
3 changed files with 20 additions and 15 deletions

View File

@ -620,7 +620,6 @@ int wxEntry(WXHINSTANCE hInstance,
#else #else
#undef CATCH_PROGRAM_EXCEPTIONS #undef CATCH_PROGRAM_EXCEPTIONS
#endif #endif
wxhInstance = (HINSTANCE) hInstance; wxhInstance = (HINSTANCE) hInstance;
if (!wxApp::Initialize()) if (!wxApp::Initialize())

View File

@ -318,15 +318,18 @@ bool wxChoice::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
} }
int n = GetSelection(); int n = GetSelection();
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, m_windowId); if (n > -1)
event.SetInt(n); {
event.SetEventObject(this); wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, m_windowId);
event.SetString(GetStringSelection()); event.SetInt(n);
if ( HasClientObjectData() ) event.SetEventObject(this);
event.SetClientObject( GetClientObject(n) ); event.SetString(GetStringSelection());
else if ( HasClientUntypedData() ) if ( HasClientObjectData() )
event.SetClientData( GetClientData(n) ); event.SetClientObject( GetClientObject(n) );
ProcessCommand(event); else if ( HasClientUntypedData() )
event.SetClientData( GetClientData(n) );
ProcessCommand(event);
}
return TRUE; return TRUE;
} }

View File

@ -38,11 +38,14 @@ bool wxComboBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
{ {
if (param == CBN_SELCHANGE) if (param == CBN_SELCHANGE)
{ {
wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, m_windowId); if (GetSelection() > -1)
event.SetInt(GetSelection()); {
event.SetEventObject(this); wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, m_windowId);
event.SetString(GetStringSelection()); event.SetInt(GetSelection());
ProcessCommand(event); event.SetEventObject(this);
event.SetString(GetStringSelection());
ProcessCommand(event);
}
return TRUE; return TRUE;
} }