]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/tbarbase.cpp
clear the frame statusbar when the mouse leaves the toolbar or enters a tool without...
[wxWidgets.git] / 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);
 }
 
 // ----------------------------------------------------------------------------