RES: [PHP-GTK] Help with Dialog/Popup
| From: | Piero B. Contezini | Date: | Wed, 03 Aug 2005 18:30:14 +0000 |
| Subject: | RES: [PHP-GTK] Help with Dialog/Popup | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-6148@lists.php.net to get a copy of this message | ||
You can't call sleep within a gtk-php program, because you don't own the
main loop, almost of the code is only generated when you pass the
control to the gtk::main function, see the timers, gtk_timeout or
something like it.
Piero
-----Mensagem original-----
De: Neil Eisgruber [mailto:neisgruber@sunblocksystems.com]
Enviada em: quarta-feira, 3 de agosto de 2005 15:16
Para: Christian Weiske
Cc: php-gtk-general@lists.php.net
Assunto: Re: [PHP-GTK] Help with Dialog/Popup
Thanks Christian, that got me a bit further.
Here is what is going on now. I have the following code:
$popup = new GtkWindow(GTK_WINDOW_DIALOG);
$label = new GtkLabel("Message goes here");
$label->show();
$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); //this will be replaced with the function that does the
real work
$popup->destroy();
Now the window appears for the 5 seconds, but the label is never drawn
within
it. I'm also not sure if this is the proper usage of
gtk::events_pending() as
the documentation confused me a bit...
Thanks,
Neil
Quoting Christian Weiske <cweiske@cweiske.de>:
> Hello Neil,
>
>
> > dialog box disappear when the function is done. Currently, not
matter what
> I
> > do, the dialog box does not appear until after the action is
complete and
> is
> > destroyed immediately. Is there any way I can accomplish this kind
of
> > functionallity with php-gtk?
>
> You don't give the system enough time to display.
> Search for gtk::events_pending in the wiki or the docs.
>
>
> Regards/MfG,
> Christian Weiske
> --
> XMMS is playing now:
>
>
--
PHP-GTK General Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php