You may be wondering how you make Ruby-GNOME2 do useful work while in Gtk.main. Well, you have several options. Using the following method you can create a timeout method that will be called every "interval" milliseconds.
Gtk.timeout_add( interval ) { method( data ) }
The first argument is the number of milliseconds between calls to your method. The second argument is the method you wish to have called, and the third, the data passed to the callback method. The return value is an integer "tag" which may be used to stop the timeout by calling:
Gtk.timeout_remove( tag )
You may also stop the timeout out method by returning zero or false from your callback method. Obviously this means if you want your method to continue, it should return a non-zero value, i.e. true.
Prev | Next |