]> git.saurik.com Git - wxWidgets.git/commitdiff
wxPropertyGrid validation failure was not (always) reset when a valid value was enter...
authorJaakko Salli <jaakko.salli@dnainternet.net>
Sat, 3 Jul 2010 11:43:49 +0000 (11:43 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Sat, 3 Jul 2010 11:43:49 +0000 (11:43 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64795 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

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

index 973b9e21131b5163c5cca30f12fbd747cc0813a7..1594894186d895240368ec87dad8c738a4ab06cf 100644 (file)
@@ -420,6 +420,16 @@ class WXDLLIMPEXP_PROPGRID wxPGValidationInfo
 {
     friend class wxPropertyGrid;
 public:
+    wxPGValidationInfo()
+    {
+        m_failureBehavior = 0;
+        m_isFailing = false;
+    }
+
+    ~wxPGValidationInfo()
+    {
+    }
+
     /**
         @return Returns failure behavior which is a combination of
                @ref propgrid_vfbflags.
@@ -468,6 +478,9 @@ private:
     /** Validation failure behavior. Use wxPG_VFB_XXX flags.
     */
     wxPGVFBFlags    m_failureBehavior;
+
+    // True when validation is currently failing.
+    bool            m_isFailing;
 };
 
 // -----------------------------------------------------------------------
index 9be3b2a3c63955fcf56d839ed7c1e362bf19fca0..937ada140e2363dd552789625263aa903e946452 100644 (file)
@@ -2987,6 +2987,7 @@ bool wxPropertyGrid::PerformValidation( wxPGProperty* p, wxVariant& pendingValue
     //
 
     m_validationInfo.m_failureBehavior = m_permanentValidationFailureBehavior;
+    m_validationInfo.m_isFailing = true;
 
     //
     // Variant list a special value that cannot be validated
@@ -3119,6 +3120,8 @@ bool wxPropertyGrid::PerformValidation( wxPGProperty* p, wxVariant& pendingValue
         pendingValue = value;
     }
 
+    m_validationInfo.m_isFailing = false;
+
     return true;
 }
 
@@ -3255,6 +3258,8 @@ void wxPropertyGrid::DoOnValidationFailureReset( wxPGProperty* property )
             DrawItemAndChildren(property);
         }
     }
+
+    m_validationInfo.m_isFailing = false;
 }
 
 // -----------------------------------------------------------------------
@@ -3271,6 +3276,9 @@ bool wxPropertyGrid::DoPropertyChanged( wxPGProperty* p, unsigned int selFlags )
 
     m_inDoPropertyChanged = 1;
 
+    // If property's value is being changed, assume it is valid
+    OnValidationFailureReset(selected);
+
     // Maybe need to update control
     wxASSERT( m_chgInfo_changedProperty != NULL );
 
@@ -3544,6 +3552,13 @@ void wxPropertyGrid::HandleCustomEditorEvent( wxEvent &event )
                                                       selected,
                                                       wnd ) )
                         valueIsPending = true;
+
+                    // Mark value always as pending if validation is currently
+                    // failing and value was not unspecified
+                    if ( !valueIsPending &&
+                         !pendingValue.IsNull() &&
+                         m_validationInfo.m_isFailing )
+                         valueIsPending = true;
                 }
                 else
                 {