Example success! almost

From: Date: Wed, 30 Aug 2006 02:42:19 +0000
Subject: Example success! almost
References: 1  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-7135@lists.php.net to get a copy of this message
Hello Webmaster Phelios, At the moment the sequence of events is as follows 01. login screen shows 02. user login correctly 03. login windows destroys and main window shows however 02a. user clicks [x] on the login window with no login .. main window should not show and the whole thing should close.. but its still showing the main window. Also would you know how to pass my $dbConnection to the main window instead of using global? Kind regards, Suomaf my main.php ==== <?php include 'login.php'; class mainClass extends GtkWindow { function __construct() { parent::__construct(); $this->glade = new GladeXML(dirname(__FILE__) . '/ui/gmsmain.glade','gmsMainForm'); $this->glade->signal_autoconnect_instance($this); $this->glade->get_widget("priorityGtkComboBoxEntry")->set_active(0); } } $myClassInstance = new mainClass(); //Start the main loop Gtk::main() ?> my login.php ===== <?php class loginClass extends GtkWindow { function __construct() { parent::__construct(); $this->glade = new GladeXML(dirname(__FILE__) . '/ui/gmslogin.glade'); $this->glade->signal_autoconnect_instance($this); $this->glade->get_widget("roleComboBoxEntry")->set_active(0); } function on_loginButton_clicked(GtkButton $btn) { $loginName = $this->glade->get_widget("loginEntry")->get_text(); $password = $this->glade->get_widget("passwordEntry")->get_text(); $role = $this->glade->get_widget("roleComboBoxEntry")->get_active_text(); $errors = null; if (strlen($loginName) == 0) { $errors .= "Username is missing.\r\n"; } if (strlen($password) == 0) { $errors .= "No password is given.\r\n"; } if (strlen($role) == 0) { $errors .= "Enter a role.\r\n"; } if ($errors !== null) { $dialog = new GtkMessageDialog($wnd, Gtk::DIALOG_MODAL, GTK::MESSAGE_ERROR, GTK::BUTTONS_OK, $errors); $dialog->set_markup("Please make sure all fields are entered:\r\n" . "<span foreground='red'>" .$errors . "</span>"); $dialog->run(); $dialog->destroy(); } else { global $dbConnection; $dbConnection = ibase_connect('192.168.0.3://opt/interbase/database/GMS/gmsprod.gdb',$loginName,$password,'ISO8859_1',16,3,$role); if (!$dbConnection) { echo "login unsuccessful.\r\n"; } else { echo "login successful\r\n"; //at this point we call the main app and pass $dbConnection to the main app and close this window $this->glade->get_widget("gmsLoginForm")->destroy(); Gtk::main_quit(); } } } function on_clearButton_clicked() { $this->glade->get_widget("loginEntry")->set_text(''); $this->glade->get_widget("passwordEntry")->set_text(''); } } $myClassInstance = new loginClass(); //Start the main loop Gtk::main() ?> -- View this message in context: http://www.nabble.com/Example-tf2179231.html#a6051475 Sent from the Php - GTK - General forum at Nabble.com.

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