Re: waiting for user input.
| From: | Alan Knowles | Date: | Tue, 05 Mar 2002 03:33:12 +0000 |
| Subject: | Re: waiting for user input. | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-1431@lists.php.net to get a copy of this message | ||
Thats correct, so you basically break the running function into two - first part deals with firing up the dialog, second part is the what happens when OK is pressed.
Rich Payne wrote:
Correct me if I'm wrong here but just setting the dialog to model does not stop execution of the calling code. It does stop the user from touching the other parts of the app but if you create the dialog in the middle of a function the function will still run to completion, regardless of the dialog's state. --rdp On 4 Mar 2002, ingui wrote:Ok I think i got it. man do i love the open source community. Thanks. On Mon, 2002-03-04 at 22:05, Alan Knowles wrote:this is the generic dialog class from phpmole, it pops up a dialog 'freezes the parent' and waits of ok/cancel etc. http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/phpmole-ide/phpmole/dialogs/phpide_Dialog_Generic.class?rev=1.16&content-type=text/vnd.viewcvs-markup key parts are: $this->window->set_transient_for($application->window); $this->window being the dialog, and $application->window being the parent one. to use it (outside phpmole), create a glade file with the widgets 'window' as the window, 'OK' as the Ok button. $application = new stdClass; $application->window = &$my_gtk_window; $mydialog = &new phpide_Dialog_Generic("full/path/to/glade/file.glade"); $mydialog->set_callbacks("my_ok_button_function"); $mydialog->show(); other wise you can extend and override the show() method to do other things you need it to. regards alan ingui wrote:Hi i am doing a program in gtk-php. This program is very recursive and has lots of iterations. At some point during the program i need to ask the user for input, so the program can continue with its execution. My problem consist that when i ask the user for the input. The program of course keeps running and wont draw the gtk window till it finds GTK::main() and the end of the program. hence drawing the window too late, and since i never get the input, the program does not work correctly. What i did was to call another program, which would ask for the input: $input=exec("php -q ask_for_user_input.php"); So the program would no continue till the user had answered my questions. This works like a charm in linux, but not so in windows for it generates a DOS shell (cmd.exe) to run the program "php ask_for_user_input.php". I can not have this, if the user by anychance clicks on the X in the toplever window of the DOS shell the whole think breaks, besides it really looks lame. My question: is there a way that while the gtk-php program is running, to draw the windows. with out having to reach for GTK::main(). and while the window is draw and waiting for the user input, the main script will wait till it gets the answers before continuing execution. Help apreciated. and sorry if my english is rusty. have not used it for while now.-- PHP-GTK General Mailing List (http://gtk.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php