]> git.saurik.com Git - wxWidgets.git/commitdiff
Added wxPropertyGrid::WasValueChangedInEvent(), added code to avoid showing colour...
authorJaakko Salli <jaakko.salli@dnainternet.net>
Sat, 11 Jul 2009 07:59:59 +0000 (07:59 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Sat, 11 Jul 2009 07:59:59 +0000 (07:59 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61404 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/propgrid/propgrid.h
interface/wx/propgrid/propgrid.h
src/propgrid/advprops.cpp

index e7bfde366e205483af74647dfd9598a5544bc52c..6ebd16505d7d31146196b8fbdef649e6951950bc 100644 (file)
@@ -1284,6 +1284,21 @@ public:
         m_iFlags |= wxPG_FL_VALUE_CHANGE_IN_EVENT;
     }
 
+    /**
+        You can use this member function, for instance, to detect in
+        wxPGProperty::OnEvent() if wxPGProperty::SetValueInEvent() was
+        already called in wxPGEditor::OnEvent(). It really only detects
+        if was value was changed using wxPGProperty::SetValueInEvent(), which
+        is usually used when a 'picker' dialog is displayed. If value was
+        written by "normal means" in wxPGProperty::StringToValue() or
+        IntToValue(), then this function will return false (on the other hand,
+        wxPGProperty::OnEvent() is not even called in those cases).
+    */
+    bool WasValueChangedInEvent() const
+    {
+        return (m_iFlags & wxPG_FL_VALUE_CHANGE_IN_EVENT) ? true : false;
+    }
+
     /** Returns true if given event is from first of an array of buttons
         (as can be in case when wxPGMultiButton is used).
     */
index 1437c07abd02aee5643e1d12ae2b43d343ec80ea..aecd686707b01e3679b61de31cd89aa9279b51de 100644 (file)
@@ -882,6 +882,18 @@ public:
         Shows an brief error message that is related to a property.
     */
     void ShowPropertyError( wxPGPropArg id, const wxString& msg );
+
+    /**
+        You can use this member function, for instance, to detect in
+        wxPGProperty::OnEvent() if wxPGProperty::SetValueInEvent() was
+        already called in wxPGEditor::OnEvent(). It really only detects
+        if was value was changed using wxPGProperty::SetValueInEvent(), which
+        is usually used when a 'picker' dialog is displayed. If value was
+        written by "normal means" in wxPGProperty::StringToValue() or
+        IntToValue(), then this function will return false (on the other hand,
+        wxPGProperty::OnEvent() is not even called in those cases).
+    */
+    bool WasValueChangedInEvent() const;
 };
 
 
index 2bb5d600bcf061fed11c4856fcb0ad83a06fb4a2..b8e03c62682cccf465a3c6453024f21f7bc62dd1 100644 (file)
@@ -1259,7 +1259,7 @@ bool wxSystemColourProperty::OnEvent( wxPropertyGrid* propgrid,
             askColour = true;
     }
 
-    if ( askColour )
+    if ( askColour && !propgrid->WasValueChangedInEvent() )
     {
         // We need to handle button click in case editor has been
         // switched to one that has wxButton as well.