wb_create_timer

bool wb_create_timer (int window, int id, int interval)

Creates a timer in the specified window. The timer must be given an integer id that must be unique to all timers and controls. interval specifies the time-out value in milliseconds. Timer events are passed to and processed by the window callback function. A call to wb_destroy_timer() destroys the timer.

Example

// A very simple digital clock

define("ID_APP_TIMER",  201);

$mainwin = wb_create_window(NULL, PopupWindow, date("h:i:s A"), 120, 0);
wb_set_handler($mainwin, "process_main");
wb_create_timer($mainwin, ID_APP_TIMER, 1000);     // One second interval
wb_main_loop();

function process_main($window, $id)
{
   switch($id) {
       case ID_APP_TIMER:
           // Show the current time in hours, minutes and seconds
           wb_set_text($window, date("h:i:s A"));
           break;

       case IDCLOSE:
           wb_destroy_window($window);
           break;
    }
}


See also

wb_destroy_timer
System functions
Callback functions and window handlers