Labels that don't update?
| From: | Benjamin Smith | Date: | Tue, 11 Feb 2003 23:35:38 +0000 |
| Subject: | Labels that don't update? | ||
| Groups: | php.gtk.general | ||
| Request: | Send a blank email to php-gtk-general+get-3025@lists.php.net to get a copy of this message | ||
I'm having trouble getting GtkLabel() widgets to update. Here's some sample
code - Why isn't this working like I think it should? Instead of indicating
that we're doing 1, 2, 3, 4 it doesn't display until it's gotten to 4.
<?
if (!class_exists('gtk'))
{
if (strtoupper(substr(PHP_OS, 0,3) == 'WIN'))
dl('php_gtk.dll');
else dl('php_gtk.so');
}
Function Go()
{
global $d;
for ($i=0; $i<5; $i++)
{
$d[label]->Set_Text('Now processing: '.$i);
sleep(2);
}
}
$d[win]=&New GtkWindow();
$d[label]=&New GtkLabel('starting');
$d[go]=&New GtkButton('Go');
$d[go]->Connect('clicked', 'go');
$d[box]=&New GtkVBox();
$d[box]->Add($d[label]);
$d[box]->Add($d[go]);
$d[win]->Add($d[box]);
$d[win]->Show_All();
gtk::main();
?>