]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/combobox.cpp
bitmap and image updates
[wxWidgets.git] / src / msw / combobox.cpp
index 9edc9f41459a070d50957deb9536ab354e13e1f5..93e9b8a731e61f2d46ee87a7d4d4dcb1ddccb23a 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;
   }
@@ -71,7 +74,12 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
   SetName(name);
   SetValidator(validator);
   if (parent) parent->AddChild(this);
-  SetBackgroundColour(parent->GetBackgroundColour()) ;
+//  SetBackgroundColour(parent->GetBackgroundColour()) ;
+
+  // A choice/combobox normally has a white background (or other, depending
+  // on global settings) rather than inheriting the parent's background colour.
+  SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW));
+
   SetForegroundColour(parent->GetForegroundColour()) ;
 
   m_windowStyle = style;