RE: [PHP-GTK] Managing Dialogs - Newbie Guided!

From: Date: Thu, 18 Jul 2002 16:01:20 +0000
Subject: RE: [PHP-GTK] Managing Dialogs - Newbie Guided!
References: 1  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-2266@lists.php.net to get a copy of this message
Rich, Your suggestion worked!!!!!!!! Since the database do_login "tests" are in a seperate function from the dialog that requests the login info, I has to pass the dialog window as a parameter of the do_login function, then destroy it: function mainapp($userisloggedin,$usersfirstname) { $main_window = &new GtkWindow(); $main_window->connect('destroy', 'shutdown'); $main_window->connect('delete-event', 'delete_event'); $main_window->set_border_width(2); $main_window->set_position(GTK_WIN_POS_CENTER); $main_window->set_title($std_title." ".$server); $main_window->set_default_size(800,600); $menubox1 = &new GtkVBox(); $main_window->add($menubox1); /*build the main app in here*/ $main_window->show_all(); } /*I changed this from my original description so if the $userisloggedin is null, they only get the dialog (no mainapp in the background*/ if (!$userisloggedin){ include ('include/qlogin_routine.inc'); login_dialog(); } else { mainapp($userisloggedin);} gtk::main(); function login_dialog(){ /*all the entry fields, select list, etc go in here*/ /*login button*/ $login_button = &new GtkButton(); $login_button->connect("clicked","do_login",$entry_login_name,$entry_passwor d,$entry_server,$entry_db,$log_dialog); $log_dialog_action_area->pack_start($login_button); } function do_login($button,$entry_login_name,$entry_password,$entry_server,$entry_db,$ login_dialog){ /*a bunch of tests with alert calls*/ $userislogged = TRUE; //if we made it this far all the tests were passed and the user can go to the mainapp. $usersfirstname = "Joe"; // or whatever $dia=$login_dialog->get_toplevel(); $dia->destroy(); mainapp($userislogged,$usersfirstname); } Rich, many thanks!!! All the different methods/functions and calls for closing windows are rather confusing at first. All, sorry if I'm confusing anyone...this is my first post here. I'll get better, I promise! --Mark -----Original Message----- From: Rich Payne [mailto:rdp@talisman.mv.com] Sent: Thursday, July 18, 2002 10:21 PM To: Mark Lopus Cc: php-gtk-general@lists.php.net Subject: Re: [PHP-GTK] Managing Dialogs - Newbie Needs Guidence! On Thu, 18 Jul 2002, Mark Lopus wrote: [snip, explination of what Mark wants to do] > 5) BUT!!!!!.....if all the login info is correct, I want the do_login > function to: > > a) set the GLOBAL variables $userisloggedin to "YES" and $usersfirstname to > "Joe" (as per the query result.) This seems to work. OK. > b) CLOSE the login_dialog dialog returning the user to the main application > window with the global variables set. But I can't seem to close the > login_dialog without shutting the whole applciation down. just destroy the dialog itself. something like... if (login_good) { $userislogged = TRUE; $usersfirstname = "Joe"; // or whatever $dialog->destroy(); // or if this function is in the dialog, $this->destroy() } > How do we handle closing the login_dialog without killing the main > applciation? Do I need to unrealize somthing? Am I misusing my close_window > function? Can you post the close_window function? Are you using nested gtk::main() calls (one in the main app, one in the dialog)? > Sorry if this is not a clear question...Any examples, insight or conceptual > pointers are greatly appreciated! Usually the best thing is to post your snippets of code.3 --rdp -- Rich Payne http://talisman.mv.com

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