Re: Help with Dialog/Popup

From: Date: Thu, 04 Aug 2005 07:47:01 +0000
Subject: Re: Help with Dialog/Popup
References: 1 2 3  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-6157@lists.php.net to get a copy of this message
Hi, in my opinion the best way is this ... $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(); $delay = 5; // Secons of delay $callback_after_delay = "hide_popup"; function hide_popup(){ global $popup; $popup->destroy(); } gtk::timeout_add($delay,$callback_after_delay); gtk::main(); Bye S. ----- Original Message ----- From: "Neil Eisgruber" <neisgruber@sunblocksystems.com> To: "Christian Weiske" <cweiske@cweiske.de> Cc: <php-gtk-general@lists.php.net> Sent: Wednesday, August 03, 2005 8:16 PM Subject: 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


« previous php.gtk.general (#6157) next »