Re: Nesting Calls to gtk::main() to Create a Login Window
| From: | simon at firepages dot com dot au | Date: | Fri, 20 Aug 2004 16:45:21 +0000 |
| Subject: | Re: Nesting Calls to gtk::main() to Create a Login Window | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-4977@lists.php.net to get a copy of this message | ||
Hi ,
in your call to quit_routine you are actually passing a GtkButton not a
GtkDialog so use connect_object & pass the $dialog ...
$ok_button->connect_object("clicked", "quit_routine",$dialog);
then modilfy the quit routine to destroy the dialog...
function quit_routine($window)
{
global $windowOneClosed;
$windowOneClosed = TRUE;
$window->destroy();
gtk::main_quit();
}
Regards,
Simon.
----- Original Message -----
From: <dpgirago@mdanderson.org>
To: <php-gtk-general@lists.php.net>
Sent: Friday, August 20, 2004 11:48 PM
Subject: [PHP-GTK] Nesting Calls to gtk::main() to Create a Login Window
> Hello PHP-GTK Listers,
>
> I've been playing with the GtkDialog Widget as I need to make a Login
> Window to access an application. I was just about to post this test code
> to the Wiki when I realized that clicking the OK button does not close the
> first window before opening up the second window. However clicking on the
> 'X' button does destroy the first window and open the second one as
> intended. I did see the entry in the manual for GtkDialog and the
> suggestion about nesting calls to gtk::main(), and it seems as if I'm on
> the right track. Can someone please suggest how I can get the button click
> to close the first window before opening the second one?
>
> <?php
>
> dl("php_gtk." . (strstr(PHP_OS, "WIN") ? "dll" :
> "so"));
>
> function quit_routine($window)
> {
> global $windowOneClosed;
> $windowOneClosed = TRUE;
> gtk::main_quit();
> }
>
> function quit_routine2($window)
> {
> global $windowOneClosed;
> gtk::main_quit();
> }
> $windowOneClosed = FALSE;
>
> $dialog = &new GtkDialog();
> $dialog->set_policy(true, false, false);
> $dialog->set_position(GTK_WIN_POS_CENTER);
> $dialog->set_title("Dialog Window");
> $dialog->connect("destroy", "quit_routine");
> $dialog->show();
>
> $dialog_vbox = $dialog->vbox;
> $dialog_action_area = $dialog->action_area;
>
> $user_info_label = &new GtkLabel("Some Important Information");
> $dialog_vbox->pack_start($user_info_label);
> $user_info_label->show();
>
> $ok_button = &new GtkButton("OK");
> $dialog_action_area->pack_start($ok_button);
> $ok_button->connect("clicked", "quit_routine");
> $ok_button->show();
>
> gtk::main();
>
> if($windowOneClosed)
> {
> $window2 = &new GtkWindow();
> $window2->set_title("Quit Window");
> $window2->connect("destroy", "quit_routine2");
> $window2->show();
> gtk::main();
> }
> ?>
>
> Thanks very much,
>
> dave