WxWidgets core timer

Being new to wxWidgets, I need some sample code for wxTimer to work.

The link provides 3 ways to use it, but does not include sample code for any of them. Optimally, I would like to get method 2.

+2
source share
1 answer

(from samples /widgets/gauge.cpp :)

Set up event constants

enum
{ 
    GaugePage_Reset = wxID_HIGHEST,
    GaugePage_Progress,

Attach an event to your member function (using the event constant)

EVT_TIMER(GaugePage_Timer, GaugeWidgetsPage::OnProgressTimer)

and then you will need to create and start your timer.

static const int INTERVAL = 300; // milliseconds
m_timer = new wxTimer(this, GaugePage_Timer);
m_timer->Start(INTERVAL);

, , , Window ISA wxEventHandler, 'this' ( ) . , , EVT_TIMER, , OnProgressTimer.

...

void GaugeWidgetsPage::OnProgressTimer(wxTimerEvent& event)
{

, .

+5

Source: https://habr.com/ru/post/1703603/


All Articles