Re: Help with Dialog/Popup

From: Date: Wed, 03 Aug 2005 19:52:31 +0000
Subject: Re: Help with Dialog/Popup
References: 1 2  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-6153@lists.php.net to get a copy of this message
A few little functions I find very useful: Function UpdateScreen() { While (gtk::events_pending()) gtk::main_iteration(); } # Magically closes a window by passing in any child widget. Function CloseWindow($widget) { # so that you can pass any child widget to close the whole window. # Great for closing popup windows with a "close" button directly as # as a callback! while ($p=$widget->parent) $widget=$p; $p->destroy(); } In use: $msg="Working on it!"; $label=&New GtkLabel($msg); $win=&New GtkWindow(); $win->Add($label); $win->Show_All(); UpdateScreen(); # update the screen with the original statement. FOR ($i=0; $i<$somebignumber; $i++) { // do some processing here... $label->Set_Text("Completed item #$i"); UpdateScreen(); # so the program responds to window move/resize commands } CloseWindow($win); Add as many set_text and updateScreen() statements as you need in your processing so the program continues to appear responsive. -Ben On Wednesday 03 August 2005 10:32, Christian Weiske wrote: > 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: > > -- "The best way to predict the future is to invent it." - XEROX PARC slogan, circa 1978

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