]> git.saurik.com Git - wxWidgets.git/commitdiff
Added check for sel == -1
authorJulian Smart <julian@anthemion.co.uk>
Wed, 3 Nov 1999 10:08:03 +0000 (10:08 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Wed, 3 Nov 1999 10:08:03 +0000 (10:08 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4335 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/app.cpp
src/msw/choice.cpp
src/msw/combobox.cpp

index 3c9f75d2ae27010eeb47fcb60c5614beb1590dfc..b45f930bf499952237321a70260a14e62b2a6ccb 100644 (file)
@@ -620,7 +620,6 @@ int wxEntry(WXHINSTANCE hInstance,
 #else
     #undef  CATCH_PROGRAM_EXCEPTIONS
 #endif
-
         wxhInstance = (HINSTANCE) hInstance;
 
         if (!wxApp::Initialize())
index c6a9f7909f1286279a058759f7965290cddc90df..90714d1e5ad0a88d8dc52708e1aa06e5276b6cd8 100644 (file)
@@ -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;
 }
index 9edc9f41459a070d50957deb9536ab354e13e1f5..0593b9342e9d804ce2ce2af40e1f41fc0b5a533d 100644 (file)
@@ -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;
   }