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.
Contents |
<?
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 User:M3nt0r/Simple_IRC_Client for details on using wb_create_timer with PHP sockets.