The id is also important, especially if you plan to have more than one wxTimer, because timer events can only be distinguished by their id.
To set a timer event handler, use wxEVT_TIMER:
Example:
constant
main = create( wxFrame, {0,-1,"Timer"} ),
timer_id = new_id(),
timer = create( wxTimer, {main, timer_id} )
procedure on_timer( atom this, atom event_type, atom id, atom event )
puts(1,"Timer\n")
end procedure
-- NOTE: using the parent and the id to identify the timer.
set_event_handler( main, timer_id, wxEVT_TIMER, routine_id("on_timer"))
-- set the timer to fire every 1 second, repeatedly
start_timer( timer, 1000, 0 )
wxMain( main )
Set the timer to fire every msec millisecond ( 1000msec = 1sec ). oneshot indicates whether the timer should stop firing after the first time, or fire repeatedly until stop_timer() is called.
Stops a timer from firing until reset using start_timer().