diff --git a/src/widgets/AButton.cpp b/src/widgets/AButton.cpp index 83667a5d9..a5110932d 100644 --- a/src/widgets/AButton.cpp +++ b/src/widgets/AButton.cpp @@ -426,18 +426,8 @@ void AButton::OnMouseEvent(wxMouseEvent & event) if (newState != prevState) { Refresh(false); - if (mCursorIsInWindow) { - #if wxUSE_TOOLTIPS // Not available in wxX11 - // Display the tooltip in the status bar - wxToolTip * pTip = this->GetToolTip(); - if( pTip ) { - wxString tipText = pTip->GetTip(); - if (!mEnabled) - tipText += _(" (disabled)"); - GetActiveProject()->TP_DisplayStatusMessage(tipText); - } - #endif - } + if (mCursorIsInWindow) + UpdateStatus(); else { GetActiveProject()->TP_DisplayStatusMessage(wxT("")); } @@ -446,6 +436,22 @@ void AButton::OnMouseEvent(wxMouseEvent & event) event.Skip(); } +void AButton::UpdateStatus() +{ + if (mCursorIsInWindow) { +#if wxUSE_TOOLTIPS // Not available in wxX11 + // Display the tooltip in the status bar + wxToolTip * pTip = this->GetToolTip(); + if( pTip ) { + wxString tipText = pTip->GetTip(); + if (!mEnabled) + tipText += _(" (disabled)"); + GetActiveProject()->TP_DisplayStatusMessage(tipText); + } +#endif + } +} + void AButton::OnCaptureLost(wxMouseCaptureLostEvent & WXUNUSED(event)) { wxMouseEvent e(wxEVT_LEFT_UP); diff --git a/src/widgets/AButton.h b/src/widgets/AButton.h index 6858e7df8..3f1e3eeb4 100644 --- a/src/widgets/AButton.h +++ b/src/widgets/AButton.h @@ -99,6 +99,11 @@ class AButton final : public wxWindow { void OnPaint(wxPaintEvent & event); void OnSize(wxSizeEvent & event); void OnMouseEvent(wxMouseEvent & event); + + // Update the status bar message if the pointer is in the button. + // Else do nothing. + void UpdateStatus(); + void OnCaptureLost(wxMouseCaptureLostEvent & event); void OnKeyDown(wxKeyEvent & event); void OnSetFocus(wxFocusEvent & event); diff --git a/src/widgets/Ruler.cpp b/src/widgets/Ruler.cpp index 7ffa5e655..ed0938c88 100644 --- a/src/widgets/Ruler.cpp +++ b/src/widgets/Ruler.cpp @@ -2790,6 +2790,8 @@ void AdornedRulerPanel::UpdateButtonStates() commands.push_back(commandName); ToolBar::SetButtonToolTip(button, commands); button.SetLabel(button.GetToolTipText()); + + button.UpdateStatus(); }; {