Re: RES: RES: [PHP-GTK] Help with Dialog/Popup
| From: | Neil Eisgruber | Date: | Wed, 03 Aug 2005 20:23:12 +0000 |
| Subject: | Re: RES: RES: [PHP-GTK] Help with Dialog/Popup | ||
| References: | 1 2 3 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-6155@lists.php.net to get a copy of this message | ||
Christian,
> gtk::main_iteration does *not* pass the control to gtk for all the time.
> You must think of a queue in which several events are waiting to be
> executed. gtk::main_iteration executes exactly one of this waiting
> events. while(gtk::events_pending()) {...} loops as long as there are
> events in the queue. If all events have been executed by
> main_iteration(), the loop ends and you (resp. your script) has control
> again.
>
So I totally understand this and feel like it's exactly what I need to
accomplish the end result I am looking for, however, when I execute the
following code the result is a popup window showing up for 5 seconds blank, then
disappearing.
function DialogWait($Title, $Message)
{
$label = &new GtkLabel($Message);
$popup = &new GtkWindow();
$popup->set_title($Title);
$popup->set_usize(300,150);
$popup->set_position(GTK_WIN_POS_CENTER);
$popup->add($label);
$popup->show_all();
while(gtk::events_pending()) gtk::main_iteration();
sleep(5);
$popup->destroy();
}
So in theory my window should be created and the while loop should allow the
program to display the window with the label. However like I said above, the
window appears with no contents and then gets destroyed after the 5 seconds.
Any idea what I am doing wrong?
Thanks for all of the help everyone!
Neil