bool wxToolBarToolBase::Toggle(bool toggle)
{
- // wxUniv toolbar toggles even non-checkable tools temporarily - should we
- // change the code there or just allow doing it?
- //wxASSERT_MSG( m_isToggle, _T("can't toggle this tool") );
+ wxASSERT_MSG( m_isToggle, _T("can't toggle this tool") );
if ( m_toggled == toggle )
return FALSE;
(void)GetEventHandler()->ProcessEvent(event);
- wxToolBarToolBase *tool = FindById(id);
- if ( !tool || !tool->GetLongHelp() )
- return;
-
wxFrame *frame = wxDynamicCast(GetParent(), wxFrame);
if ( !frame )
return;
- frame->SetStatusText(tool->GetLongHelp());
+ wxString helpstring;
+
+ if ( id != -1 )
+ {
+ wxToolBarToolBase *tool = FindById(id);
+ if ( tool )
+ helpstring = tool->GetLongHelp();
+ }
+
+ // set the status text anyhow, even if the string is empty: this ensures
+ // that it is cleared when the mouse leaves the toolbar or enters a tool
+ // without help
+ frame->SetStatusText(helpstring);
}
// ----------------------------------------------------------------------------