]> git.saurik.com Git - wxWidgets.git/commitdiff
Yet another fix for the colour property 'Custom' entry (get drop-down list index...
authorJaakko Salli <jaakko.salli@dnainternet.net>
Sun, 12 Jul 2009 09:59:26 +0000 (09:59 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Sun, 12 Jul 2009 09:59:26 +0000 (09:59 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61412 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/propgrid/advprops.cpp

index b8e03c62682cccf465a3c6453024f21f7bc62dd1..c8d50cd201d916d9732d12c65767eaaa0b770492 100644 (file)
@@ -62,6 +62,8 @@
     #include "wx/msw/dc.h"
 #endif
 
+#include "wx/odcombo.h"
+
 // -----------------------------------------------------------------------
 
 #if defined(__WXMSW__)
@@ -1250,19 +1252,29 @@ bool wxSystemColourProperty::OnEvent( wxPropertyGrid* propgrid,
 
     if ( propgrid->IsMainButtonEvent(event) )
     {
+        // We need to handle button click in case editor has been
+        // switched to one that has wxButton as well.
         askColour = true;
     }
     else if ( event.GetEventType() == wxEVT_COMMAND_COMBOBOX_SELECTED )
     {
-        if ( GetIndex() == GetCustomColourIndex() &&
-             !(m_flags & wxPG_PROP_HIDE_CUSTOM_COLOUR) )
-            askColour = true;
+               // Must override index detection since at this point GetIndex()
+               // will return old value.
+               wxOwnerDrawnComboBox* cb =
+                       static_cast<wxOwnerDrawnComboBox*>(propgrid->GetEditorControl());
+
+               if ( cb )
+               {
+                       int index = cb->GetSelection();
+
+                       if ( index == GetCustomColourIndex() &&
+                                !(m_flags & wxPG_PROP_HIDE_CUSTOM_COLOUR) )
+                               askColour = true;
+               }
     }
 
     if ( askColour && !propgrid->WasValueChangedInEvent() )
     {
-        // We need to handle button click in case editor has been
-        // switched to one that has wxButton as well.
         wxVariant variant;
         if ( QueryColourFromUser(variant) )
             return true;