【发布时间】:2015-12-05 13:40:58
【问题描述】:
我正在使用wxTimerEvent() 以特定频率调用函数。但它并不总是按预期调用该函数。
例如,它可以在随机的时间段内正常工作,然后它在几秒钟内根本不调用该函数。 S这是我的代码块。请帮我解决这个问题...
class MyFrame : public wxFrame
{
public:
...
void OnTimer(wxTimerEvent& event);
private:
wxTimer *mTimer
wxDECLARE_EVENT_TABLE();
};
wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_TIMER(TIMER_ID, MyFrame::OnTimer)
wxEND_EVENT_TABLE()
MyFrame::MyFrame()
{
mTimer = new wxTimer(this, TIMER_ID)
m_timer.Start(100); // 100 millisecond interval
}
void MyFrame::OnTimer(wxTimerEvent& event)
{
// my logic -this is working fine... just set a flag.
}
【问题讨论】: