Added new wxPropertyGrid property validation failure flags wxPG_VFB_SHOW_MESSAGEBOX and wxPG_VFB_SHOW_MESSAGE_ON_STATUSBAR, which allow defining the default message display behavior more accurately

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64805 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli
2010-07-04 08:22:52 +00:00
parent a3669fa95b
commit 0ea0604a1e
4 changed files with 78 additions and 5 deletions

View File

@@ -3247,14 +3247,32 @@ bool wxPropertyGrid::DoOnValidationFailure( wxPGProperty* property, wxVariant& W
}
}
if ( vfb & wxPG_VFB_SHOW_MESSAGE )
if ( vfb & (wxPG_VFB_SHOW_MESSAGE |
wxPG_VFB_SHOW_MESSAGEBOX |
wxPG_VFB_SHOW_MESSAGE_ON_STATUSBAR) )
{
wxString msg = m_validationInfo.m_failureMessage;
if ( !msg.length() )
msg = wxT("You have entered invalid value. Press ESC to cancel editing.");
msg = _("You have entered invalid value. Press ESC to cancel editing.");
DoShowPropertyError(property, msg);
#if wxUSE_STATUSBAR
if ( vfb & wxPG_VFB_SHOW_MESSAGE_ON_STATUSBAR )
{
if ( !wxPGGlobalVars->m_offline )
{
wxStatusBar* pStatusBar = GetStatusBar();
if ( pStatusBar )
pStatusBar->SetStatusText(msg);
}
}
#endif
if ( vfb & wxPG_VFB_SHOW_MESSAGE )
DoShowPropertyError(property, msg);
if ( vfb & wxPG_VFB_SHOW_MESSAGEBOX )
::wxMessageBox(msg, _("Property Error"));
}
return (vfb & wxPG_VFB_STAY_IN_PROPERTY) ? false : true;
@@ -3284,6 +3302,18 @@ void wxPropertyGrid::DoOnValidationFailureReset( wxPGProperty* property )
}
}
#if wxUSE_STATUSBAR
if ( vfb & wxPG_VFB_SHOW_MESSAGE_ON_STATUSBAR )
{
if ( !wxPGGlobalVars->m_offline )
{
wxStatusBar* pStatusBar = GetStatusBar();
if ( pStatusBar )
pStatusBar->SetStatusText(wxEmptyString);
}
}
#endif
if ( vfb & wxPG_VFB_SHOW_MESSAGE )
{
DoHidePropertyError(property);