gtk::timeout_add Help please !
| From: | Juan Gonzalez | Date: | Sun, 25 Jan 2004 19:53:30 +0000 |
| Subject: | gtk::timeout_add Help please ! | ||
| Groups: | php.gtk.general | ||
| Request: | Send a blank email to php-gtk-general+get-4367@lists.php.net to get a copy of this message | ||
Hi to all
I am trying to execute a function multiple time and display the number of time the function had
executed in a label. The problem I am having is the code execute once and quite, I tried different
things suggested on the archive mailing list with not success. Could somebody help me figure this
out please!!.
Below is the code I am using.
You help on this will be really appreciated.
Thanks.
<?php
if (!extension_loaded('gtk')) {
dl( 'php_gtk.' . PHP_SHLIB_SUFFIX);
}
function test() {
$x = $x + 1;
return true;
}
function delete_event()
{
return false;
}
function destroy()
{
Gtk::main_quit();
}
$window = &new GtkWindow();
$window->connect('destroy', 'destroy');
$window->connect('delete-event', 'delete_event');
$window->set_border_width(10);
$window->set_usize(300, 300);
$window->set_title('Web Upload');
$frame = &new GtkFrame('Counter');
$window->add($frame);
$frame->show();
$box1 = &new GtkVBox();
$frame->add($box1);
$box1->show();
$label = &new GtkLabel();
$box1->pack_start($label);
$label->show();
$separator = &new GtkHSeparator();
$box1->pack_start($separator);
$separator->show();
$box2 = &new GtkHButtonBox();
$box2->set_layout(GTK_BUTTONBOX_SPREAD);
$box1->add($box2);
$box1->show();
$button = &new GtkButton('Exit');
$button->connect('clicked', 'destroy');
$box2->pack_start($button);
$label->set_text($x);
/*
* Show the window and all its child widgets.
*/
$window->show_all();
gtk::timeout_add(5000,array($window, 'test'));
/* Run the main loop. */
Gtk::main();
?>
---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!