wxPropertyGrid validation failure was not (always) reset when a valid value was entered after an invalid one.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64795 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli
2010-07-03 11:43:49 +00:00
parent 3217f79df1
commit 8915141c1e
2 changed files with 28 additions and 0 deletions

View File

@@ -420,6 +420,16 @@ class WXDLLIMPEXP_PROPGRID wxPGValidationInfo
{ {
friend class wxPropertyGrid; friend class wxPropertyGrid;
public: public:
wxPGValidationInfo()
{
m_failureBehavior = 0;
m_isFailing = false;
}
~wxPGValidationInfo()
{
}
/** /**
@return Returns failure behavior which is a combination of @return Returns failure behavior which is a combination of
@ref propgrid_vfbflags. @ref propgrid_vfbflags.
@@ -468,6 +478,9 @@ private:
/** Validation failure behavior. Use wxPG_VFB_XXX flags. /** Validation failure behavior. Use wxPG_VFB_XXX flags.
*/ */
wxPGVFBFlags m_failureBehavior; wxPGVFBFlags m_failureBehavior;
// True when validation is currently failing.
bool m_isFailing;
}; };
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------

View File

@@ -2987,6 +2987,7 @@ bool wxPropertyGrid::PerformValidation( wxPGProperty* p, wxVariant& pendingValue
// //
m_validationInfo.m_failureBehavior = m_permanentValidationFailureBehavior; m_validationInfo.m_failureBehavior = m_permanentValidationFailureBehavior;
m_validationInfo.m_isFailing = true;
// //
// Variant list a special value that cannot be validated // Variant list a special value that cannot be validated
@@ -3119,6 +3120,8 @@ bool wxPropertyGrid::PerformValidation( wxPGProperty* p, wxVariant& pendingValue
pendingValue = value; pendingValue = value;
} }
m_validationInfo.m_isFailing = false;
return true; return true;
} }
@@ -3255,6 +3258,8 @@ void wxPropertyGrid::DoOnValidationFailureReset( wxPGProperty* property )
DrawItemAndChildren(property); DrawItemAndChildren(property);
} }
} }
m_validationInfo.m_isFailing = false;
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
@@ -3271,6 +3276,9 @@ bool wxPropertyGrid::DoPropertyChanged( wxPGProperty* p, unsigned int selFlags )
m_inDoPropertyChanged = 1; m_inDoPropertyChanged = 1;
// If property's value is being changed, assume it is valid
OnValidationFailureReset(selected);
// Maybe need to update control // Maybe need to update control
wxASSERT( m_chgInfo_changedProperty != NULL ); wxASSERT( m_chgInfo_changedProperty != NULL );
@@ -3544,6 +3552,13 @@ void wxPropertyGrid::HandleCustomEditorEvent( wxEvent &event )
selected, selected,
wnd ) ) wnd ) )
valueIsPending = true; 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 else
{ {