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:
@@ -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())
|
||||||
|
@@ -318,6 +318,8 @@ bool wxChoice::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
|
|||||||
}
|
}
|
||||||
|
|
||||||
int n = GetSelection();
|
int n = GetSelection();
|
||||||
|
if (n > -1)
|
||||||
|
{
|
||||||
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, m_windowId);
|
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, m_windowId);
|
||||||
event.SetInt(n);
|
event.SetInt(n);
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
@@ -327,6 +329,7 @@ bool wxChoice::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
|
|||||||
else if ( HasClientUntypedData() )
|
else if ( HasClientUntypedData() )
|
||||||
event.SetClientData( GetClientData(n) );
|
event.SetClientData( GetClientData(n) );
|
||||||
ProcessCommand(event);
|
ProcessCommand(event);
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@@ -37,12 +37,15 @@ IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl)
|
|||||||
bool wxComboBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
|
bool wxComboBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
|
||||||
{
|
{
|
||||||
if (param == CBN_SELCHANGE)
|
if (param == CBN_SELCHANGE)
|
||||||
|
{
|
||||||
|
if (GetSelection() > -1)
|
||||||
{
|
{
|
||||||
wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, m_windowId);
|
wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, m_windowId);
|
||||||
event.SetInt(GetSelection());
|
event.SetInt(GetSelection());
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
event.SetString(GetStringSelection());
|
event.SetString(GetStringSelection());
|
||||||
ProcessCommand(event);
|
ProcessCommand(event);
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user