Don't overwrite status message when restoring it if it changed.
wxFrameBase::DoGiveHelp() could rewrite the status bar message if it was changed while the menu was showing. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61626 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -210,6 +210,9 @@ protected:
|
|||||||
#if wxUSE_STATUSBAR && (wxUSE_MENUS || wxUSE_TOOLBAR)
|
#if wxUSE_STATUSBAR && (wxUSE_MENUS || wxUSE_TOOLBAR)
|
||||||
// the saved status bar text overwritten by DoGiveHelp()
|
// the saved status bar text overwritten by DoGiveHelp()
|
||||||
wxString m_oldStatusText;
|
wxString m_oldStatusText;
|
||||||
|
|
||||||
|
// the last help string we have shown in the status bar
|
||||||
|
wxString m_lastHelpShown;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if wxUSE_STATUSBAR
|
#if wxUSE_STATUSBAR
|
||||||
|
@@ -419,12 +419,27 @@ void wxFrameBase::DoGiveHelp(const wxString& help, bool show)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_lastHelpShown =
|
||||||
text = help;
|
text = help;
|
||||||
}
|
}
|
||||||
else // hide help, restore the original text
|
else // hide help, restore the original text
|
||||||
{
|
{
|
||||||
text = m_oldStatusText;
|
// clear the last shown help string but remember its value
|
||||||
m_oldStatusText.clear();
|
wxString lastHelpShown;
|
||||||
|
lastHelpShown.swap(m_lastHelpShown);
|
||||||
|
|
||||||
|
// also clear the old status text but remember it too to restore it
|
||||||
|
// below
|
||||||
|
text.swap(m_oldStatusText);
|
||||||
|
|
||||||
|
if ( statbar->GetStatusText(m_statusBarPane) != lastHelpShown )
|
||||||
|
{
|
||||||
|
// if the text was changed with an explicit SetStatusText() call
|
||||||
|
// from the user code in the meanwhile, do not overwrite it with
|
||||||
|
// the old status bar contents -- this is almost certainly not what
|
||||||
|
// the user expects and would be very hard to avoid from user code
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
statbar->SetStatusText(text, m_statusBarPane);
|
statbar->SetStatusText(text, m_statusBarPane);
|
||||||
|
Reference in New Issue
Block a user