Use wxTimer::StartOnce() instead of wxTIMER_ONE_SHOT

This is more readable and shorter, so encourage using this form.

No real changes.
This commit is contained in:
Vadim Zeitlin 2023-11-07 19:01:38 +01:00
parent 39079cbf23
commit 163d310369
4 changed files with 5 additions and 5 deletions

View file

@ -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.

View file

@ -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

View file

@ -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 )

View file

@ -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() )
{