RE: [PHP-GTK] Why?

From: Date: Wed, 14 Mar 2001 00:38:21 +0000
Subject: RE: [PHP-GTK] Why?
References: 1 2  Groups: php.gtk 
Request: Send a blank email to php-gtk+get-825@lists.php.net to get a copy of this message
Ey! That's great Steph! Thank you very much. Now, let me see if I understood how php is working here: connect passes arguments to a function like this?: connect(event, function, 1, 2, 3...) where 1...n are the arguments of function and what about $ok_button? why isn't it necessary to include it like an argument of print_filename? Is it automatically passed? Oh, by the way, an important thing to tell: It isn't necessary to declare $PHP_FILE as global. It can be a local variable of print_filename, or you can directly do this: function print_filename ($ok_button, $fs) { echo $fs->get_filename(); return true; } That's all from here, AfterGlow. AfterGlow is the air that remains a short time after sunset. ----- Mensaje original ----- De: ""Steph"" <Steph.Fox@btinternet.com> Grupos de noticias: php.gtk Enviado: Martes, 13 de Marzo de 2001 08:13 p.m. Asunto: Re: [PHP-GTK] Why? Guido, Sorry to keep you waiting, I crunched a Windows dll running something earlier & lost all keyboard functions! You need to pass the reference to a globally defined variable like so: function print_filename ($ok_button, $fs) { global $PHP_FILE; $PHP_FILE = $fs->get_filename(); print "$PHP_FILE\n"; return true; } ( this goes in the function FileDialog() { bit) $ok_button = $fs->ok_button; $ok_button->connect ('clicked', 'print_filename', $fs); $ok_button->connect_object('clicked', array($fs, 'destroy')); & yeah, I had to ask too ..... I've got mine opening php files from the desktop, now, print was the first I tried to do cos it's easier (you'd think). So please test this, cos I've a lot more items in there now. hth, Steph ----- Original Message ----- From: "Guido" <snoop@velocom.com.ar> To: <php-gtk@lists.php.net> Sent: Tuesday, March 13, 2001 10:32 PM Subject: [PHP-GTK] Why? Hey yoo!! How are you guys... Look, I've tried to modify the fileselection.php script so when you click the ok button in the file selection, the file selected is printed on the command screen. Well, this is what I did first: function EndDialog($name) { print $name . "\n"; return true; } function FileDialog() { $fs = &new GtkFileSelection('File Selection Example'); $ok_button = $fs->ok_button; $ok_button->connect('clicked', 'enddialog($fs->get_filename())'); $ok_button->connect_object('clicked', array($fs, 'destroy')); $cancel_button = $fs->cancel_button; $cancel_button->connect('clicked', 'canceldialog'); $cancel_button->connect_object('clicked', array($fs, 'destroy')); $fs->show(); } This didn't work and I think that it was a fatal error too. Well, can anybody tell me please how can I pass parameters to any function from a connect call? or should I use other method? Thank you very much. AfterGlow. -- PHP GTK Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-gtk-unsubscribe@lists.php.net For additional commands, e-mail: php-gtk-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.gtk (#825) next »