-1
我正在使用wxTimerEvent()
以特定頻率調用某個函數。但它並不總是按預期調用函數。wxTimerEvent並不總是以預期間隔呼叫
例如,它對於一個隨機的持續時間工作正常,然後它幾秒鐘不會調用該函數。 SHere是我的代碼塊。請幫我找出這個問題...
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.
}