Eliminated lingering validation failure message on the status bar. Added wxPropertyGrid virtual member functions DoHidePropertyError() and GetStatusBar().
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64796 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1601,12 +1601,38 @@ public:
|
|||||||
m_validationInfo.m_failureMessage.clear();
|
m_validationInfo.m_failureMessage.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Override in derived class to display error messages in custom manner
|
/**
|
||||||
|
Override in derived class to display error messages in custom manner
|
||||||
(these message usually only result from validation failure).
|
(these message usually only result from validation failure).
|
||||||
|
|
||||||
|
@remarks If you implement this, then you also need to implement
|
||||||
|
DoHidePropertyError() - possibly to do nothing, if error
|
||||||
|
does not need hiding (e.g. it was logged or shown in a
|
||||||
|
message box).
|
||||||
|
|
||||||
|
@see DoHidePropertyError()
|
||||||
*/
|
*/
|
||||||
virtual void DoShowPropertyError( wxPGProperty* property,
|
virtual void DoShowPropertyError( wxPGProperty* property,
|
||||||
const wxString& msg );
|
const wxString& msg );
|
||||||
|
|
||||||
|
/**
|
||||||
|
Override in derived class to hide an error displayed by
|
||||||
|
DoShowPropertyError().
|
||||||
|
|
||||||
|
@see DoShowPropertyError()
|
||||||
|
*/
|
||||||
|
virtual void DoHidePropertyError( wxPGProperty* property );
|
||||||
|
|
||||||
|
#if wxUSE_STATUSBAR
|
||||||
|
/**
|
||||||
|
Return wxStatusBar that is used by this wxPropertyGrid. You can
|
||||||
|
reimplement this member function in derived class to override
|
||||||
|
the default behavior of using the top-level wxFrame's status
|
||||||
|
bar, if any.
|
||||||
|
*/
|
||||||
|
virtual wxStatusBar* GetStatusBar();
|
||||||
|
#endif
|
||||||
|
|
||||||
/** Override to customize property validation failure behavior.
|
/** Override to customize property validation failure behavior.
|
||||||
@param invalidValue
|
@param invalidValue
|
||||||
Value which failed in validation.
|
Value which failed in validation.
|
||||||
|
@@ -1044,6 +1044,45 @@ public:
|
|||||||
*/
|
*/
|
||||||
void SetVerticalSpacing( int vspacing );
|
void SetVerticalSpacing( int vspacing );
|
||||||
|
|
||||||
|
/**
|
||||||
|
@name wxPropertyGrid customization
|
||||||
|
|
||||||
|
Reimplement these member functions in derived class for better
|
||||||
|
control over wxPropertyGrid behavior.
|
||||||
|
*/
|
||||||
|
//@{
|
||||||
|
|
||||||
|
/**
|
||||||
|
Override in derived class to display error messages in custom manner
|
||||||
|
(these message usually only result from validation failure).
|
||||||
|
|
||||||
|
@remarks If you implement this, then you also need to implement
|
||||||
|
DoHidePropertyError() - possibly to do nothing, if error
|
||||||
|
does not need hiding (e.g. it was logged or shown in a
|
||||||
|
message box).
|
||||||
|
|
||||||
|
@see DoHidePropertyError()
|
||||||
|
*/
|
||||||
|
virtual void DoShowPropertyError( wxPGProperty* property,
|
||||||
|
const wxString& msg );
|
||||||
|
|
||||||
|
/**
|
||||||
|
Override in derived class to hide an error displayed by
|
||||||
|
DoShowPropertyError().
|
||||||
|
|
||||||
|
@see DoShowPropertyError()
|
||||||
|
*/
|
||||||
|
virtual void DoHidePropertyError( wxPGProperty* property );
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return wxStatusBar that is used by this wxPropertyGrid. You can
|
||||||
|
reimplement this member function in derived class to override
|
||||||
|
the default behavior of using the top-level wxFrame's status
|
||||||
|
bar, if any.
|
||||||
|
*/
|
||||||
|
virtual wxStatusBar* GetStatusBar();
|
||||||
|
|
||||||
|
//@}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@name Property development functions
|
@name Property development functions
|
||||||
|
@@ -3127,6 +3127,22 @@ bool wxPropertyGrid::PerformValidation( wxPGProperty* p, wxVariant& pendingValue
|
|||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
|
#if wxUSE_STATUSBAR
|
||||||
|
wxStatusBar* wxPropertyGrid::GetStatusBar()
|
||||||
|
{
|
||||||
|
wxWindow* topWnd = ::wxGetTopLevelParent(this);
|
||||||
|
if ( topWnd && topWnd->IsKindOf(CLASSINFO(wxFrame)) )
|
||||||
|
{
|
||||||
|
wxFrame* pFrame = wxStaticCast(topWnd, wxFrame);
|
||||||
|
if ( pFrame )
|
||||||
|
return pFrame->GetStatusBar();
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
void wxPropertyGrid::DoShowPropertyError( wxPGProperty* WXUNUSED(property), const wxString& msg )
|
void wxPropertyGrid::DoShowPropertyError( wxPGProperty* WXUNUSED(property), const wxString& msg )
|
||||||
{
|
{
|
||||||
if ( !msg.length() )
|
if ( !msg.length() )
|
||||||
@@ -3135,21 +3151,13 @@ void wxPropertyGrid::DoShowPropertyError( wxPGProperty* WXUNUSED(property), cons
|
|||||||
#if wxUSE_STATUSBAR
|
#if wxUSE_STATUSBAR
|
||||||
if ( !wxPGGlobalVars->m_offline )
|
if ( !wxPGGlobalVars->m_offline )
|
||||||
{
|
{
|
||||||
wxWindow* topWnd = ::wxGetTopLevelParent(this);
|
wxStatusBar* pStatusBar = GetStatusBar();
|
||||||
if ( topWnd )
|
|
||||||
{
|
|
||||||
wxFrame* pFrame = wxDynamicCast(topWnd, wxFrame);
|
|
||||||
if ( pFrame )
|
|
||||||
{
|
|
||||||
wxStatusBar* pStatusBar = pFrame->GetStatusBar();
|
|
||||||
if ( pStatusBar )
|
if ( pStatusBar )
|
||||||
{
|
{
|
||||||
pStatusBar->SetStatusText(msg);
|
pStatusBar->SetStatusText(msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
::wxMessageBox(msg, wxT("Property Error"));
|
::wxMessageBox(msg, wxT("Property Error"));
|
||||||
@@ -3157,6 +3165,23 @@ void wxPropertyGrid::DoShowPropertyError( wxPGProperty* WXUNUSED(property), cons
|
|||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
|
void wxPropertyGrid::DoHidePropertyError( wxPGProperty* WXUNUSED(property) )
|
||||||
|
{
|
||||||
|
#if wxUSE_STATUSBAR
|
||||||
|
if ( !wxPGGlobalVars->m_offline )
|
||||||
|
{
|
||||||
|
wxStatusBar* pStatusBar = GetStatusBar();
|
||||||
|
if ( pStatusBar )
|
||||||
|
{
|
||||||
|
pStatusBar->SetStatusText(wxEmptyString);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
bool wxPropertyGrid::OnValidationFailure( wxPGProperty* property,
|
bool wxPropertyGrid::OnValidationFailure( wxPGProperty* property,
|
||||||
wxVariant& invalidValue )
|
wxVariant& invalidValue )
|
||||||
{
|
{
|
||||||
@@ -3259,6 +3284,11 @@ void wxPropertyGrid::DoOnValidationFailureReset( wxPGProperty* property )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( vfb & wxPG_VFB_SHOW_MESSAGE )
|
||||||
|
{
|
||||||
|
DoHidePropertyError(property);
|
||||||
|
}
|
||||||
|
|
||||||
m_validationInfo.m_isFailing = false;
|
m_validationInfo.m_isFailing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4214,14 +4244,7 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags )
|
|||||||
|
|
||||||
if ( !(GetExtraStyle() & wxPG_EX_HELP_AS_TOOLTIPS) )
|
if ( !(GetExtraStyle() & wxPG_EX_HELP_AS_TOOLTIPS) )
|
||||||
{
|
{
|
||||||
wxStatusBar* statusbar = NULL;
|
wxStatusBar* statusbar = GetStatusBar();
|
||||||
if ( !(m_iFlags & wxPG_FL_NOSTATUSBARHELP) )
|
|
||||||
{
|
|
||||||
wxFrame* frame = wxDynamicCast(::wxGetTopLevelParent(this),wxFrame);
|
|
||||||
if ( frame )
|
|
||||||
statusbar = frame->GetStatusBar();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( statusbar )
|
if ( statusbar )
|
||||||
{
|
{
|
||||||
const wxString* pHelpString = (const wxString*) NULL;
|
const wxString* pHelpString = (const wxString*) NULL;
|
||||||
|
Reference in New Issue
Block a user