Hello,
Calling a function on a repetitive basis is simple enough using something like:
Gtk::timeout_add(200, 'subtract'); //call subtract() 5 times per second
However, how would I call subtract() if it is within a class? Example:
The Timer class simplifies the use of delays between user actions, without freezing the UI.
I had trouble finding this out, so here it is. If you want to manage a network connection (i.e. an IRC connection) you need a while (1) {} loop.
This cannot be done in PHP-GTK, because of the
gtk::main() function. So, there is the
gtk::timeout_add($time, $function)
that executes a function every $time milliseconds.
This solves our problem.
Your function must return TRUE else it will not be called again. Return FALSE to cancel the timeout.
Commentaires récents
il y a 47 semaines 3 jours
il y a 48 semaines 2 jours
il y a 48 semaines 6 jours
il y a 51 semaines 2 jours
il y a 1 an 19 semaines
il y a 1 an 23 semaines
il y a 1 an 27 semaines
il y a 1 an 27 semaines
il y a 1 an 27 semaines
il y a 1 an 44 semaines