]> git.saurik.com Git - wxWidgets.git/commitdiff
clear the frame statusbar when the mouse leaves the toolbar or enters a tool without...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 17 Mar 2002 13:58:15 +0000 (13:58 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 17 Mar 2002 13:58:15 +0000 (13:58 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14656 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/tbarbase.cpp

index e88af6fddb1acfeb270ed0c724d281269535af6b..93d6bbfc3f1dad28a521f16a7fc5eec955fb1598 100644 (file)
@@ -505,15 +505,23 @@ void wxToolBarBase::OnMouseEnter(int id)
 
     (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);
 }
 
 // ----------------------------------------------------------------------------