From 163d310369df0ee1a10faa4559fdf9dbced495c5 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 7 Nov 2023 19:01:38 +0100 Subject: [PATCH] Use wxTimer::StartOnce() instead of wxTIMER_ONE_SHOT This is more readable and shorter, so encourage using this form. No real changes. --- interface/wx/timer.h | 4 ++-- samples/stc/stctest.cpp | 2 +- src/generic/listctrl.cpp | 2 +- src/generic/treectlg.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/interface/wx/timer.h b/interface/wx/timer.h index 84bf360650..d2fdcba86c 100644 --- a/interface/wx/timer.h +++ b/interface/wx/timer.h @@ -126,8 +126,8 @@ public: To make your code more readable you may also use the following symbolic constants: - wxTIMER_CONTINUOUS: Start a normal, continuously running, timer - - wxTIMER_ONE_SHOT: Start a one shot timer - Alternatively, use StartOnce(). + - wxTIMER_ONE_SHOT: Start a one shot timer. Alternatively, and + preferably, call StartOnce() instead of this function. If the timer was already running, it will be stopped by this method before restarting it. diff --git a/samples/stc/stctest.cpp b/samples/stc/stctest.cpp index 09a468da6e..215be399d7 100644 --- a/samples/stc/stctest.cpp +++ b/samples/stc/stctest.cpp @@ -668,7 +668,7 @@ AppAbout::AppAbout (wxWindow *parent, m_timer = nullptr; if (milliseconds > 0) { m_timer = new wxTimer (this, myID_ABOUTTIMER); - m_timer->Start (milliseconds, wxTIMER_ONE_SHOT); + m_timer->StartOnce(milliseconds); } // Get version of Scintilla diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index b67277023c..862b6f16c9 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -3168,7 +3168,7 @@ void wxListMainWindow::OnChar( wxKeyEvent &event ) // Notice that we should start the timer even if we didn't find // anything to make sure we reset the search state later. - m_findTimer->Start(wxListFindTimer::DELAY, wxTIMER_ONE_SHOT); + m_findTimer->StartOnce(wxListFindTimer::DELAY); // restart timer even when there's no match so bell get's reset if ( item != (size_t)-1 ) diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index e3dcd34ea0..3e8e60e3fa 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -3389,7 +3389,7 @@ void wxGenericTreeCtrl::OnChar( wxKeyEvent &event ) // Notice that we should start the timer even if we didn't find // anything to make sure we reset the search state later. - m_findTimer->Start(wxTreeFindTimer::DELAY, wxTIMER_ONE_SHOT); + m_findTimer->StartOnce(wxTreeFindTimer::DELAY); if ( id.IsOk() ) {