Re: php-gtk and globals

From: Date: Sun, 19 Jan 2003 12:43:44 +0000
Subject: Re: php-gtk and globals
References: 1  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-2925@lists.php.net to get a copy of this message
hrm make the entry global in the function where you make the connection, and pass the entry as part of the 'clicked' signal. ----- Original Message ----- From: "Iuri Fiedoruk" <iuri.f@terra.com.br> To: <php-gtk-general@lists.php.net> Sent: Sunday, January 19, 2003 12:29 PM Subject: [PHP-GTK] php-gtk and globals -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I'm restarting (again) to program with php-gtk and I have some small doubts. I have two functions here, one that draws a login screen (pretty simple) and another that should test the login. The thing I want to know is how to make my test_login() function to "see" the value on the entry when I press the login button. I've tryied to make $login_input (the entry) global, but this didn't worked. So I assume I have to pass the value as argument in the $button->connect(), right? // função que testa o login function test_login() { // global $login_window; global $login_input; $login = $login_input->get_text(); echo "Login: $login\n"; } // create and shows a login screen function draw_login() { global $login_window; // cria janela $login_window = &new GtkWindow(); $login_window->connect('destroy', 'destroy'); $login_window->connect('delete-event', 'delete_event'); $login_window->set_border_width(10); // cria box vertical apra conter items $v_box1 = &new GtkVBox(false, 10); // adiciona caixa vertical na janela $login_window->add($v_box1); // cria caixa horizonal para texto do login e input do login $h_box1 = &new GtkHBox(false, 10); // coloca caixa horizontal na caixa vertical $v_box1->add($h_box1); // cria texto de login $login_text = &new GtkLabel('Login: '); // cria input de login $login_input = &new GtkEntry(); // coloca texto e input de login na caixa horizontal $h_box1->add($login_text); $h_box1->add($login_input); // cria botão de login $button = &new GtkButton('login'); // conecta o botão a uma função que testa o login $button->connect('clicked', 'test_login'); // coloca botão na caixa vertical $v_box1->add($button); // mostra janela e seus widgets $login_window->show_all(); } - -- Iuri Fiedoruk Santa Maria, RS, Brasil -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE+KpoSZDi0YID7IhsRAgoAAJ9uFFUzBfKS1cpB0MjZA9NMzbMETgCdHj1S u00jHcHbjVCcoH2pDouQqEc= =rpfj -----END PGP SIGNATURE----- -- PHP-GTK General Mailing List (http://gtk.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

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