Re: expanding the program... FIXED

From: Date: Tue, 29 Jan 2002 21:54:48 +0000
Subject: Re: expanding the program... FIXED
References: 1 2  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-1067@lists.php.net to get a copy of this message
$gtkobject->flags(); returns an array of 4 integers that will give info re object status. & is it the activate signal you're chasing, or am I confused? ----- Original Message ----- From: "Iuri Fiedoruk" <iuri.f@terra.com.br> To: <iuri.f@terra.com.br> Cc: <php-gtk-general@lists.php.net> Sent: Tuesday, January 29, 2002 9:37 PM Subject: Re: [PHP-GTK] expanding the program... FIXED > Iuri Fiedoruk wrote: > > > I made a bit more on my program and sure got some more problems. > > First function is called when you choose connect on menu and updates the > > main_label text box with output from connection. > > Second is called when you press a button on the input_label input text > > (I did this with button press > > because I still don't know how to call a event when you press enter on > > a input. > > The big problem I have now is that even that send_input reconizes fp > > as resorse #8 it dosen't > > send the data as should on fputs. This problem usually is due to $fp > > being called as global (for > > what I know it dosen't like being used that way) so it should only be > > used on function number one. > > In this case, is there a way to put function 2 inside function 1? In > > other words, there is a way that a > > event can be inserted on the middle of a function instead of being > > linked to it's own function? > > If not (as I belive) is there any way to use $fp as global or other > > way to do this? > > (Sorry if I could not explain it well) > > > > > > function on_connect_menu_activate() { > > global $main_label, $fp; > > $server_name = "moo.ufsm.br"; > > $port_nr = 7777; > > $fp = fsockopen($server_name, $port_nr, &$errno, &$errstr) or > > die("$errno: $errrstr"); > > set_socket_blocking($fp, 0); > > while ($fim != 1) { > > while (gtk::events_pending()) { > > gtk::main_iteration(); > > } > > if ($timeout > 6000) { > > $fim = 1; > > fclose($fp); > > die("TIMEOUT"); > > } > > $msg = fgets($fp, 100); > > $pos = $main_label->get_length(); > > $main_label->insert_text($msg,$pos); > > usleep(400); > > } > > } > > > > function send_input() { > > echo("FUNCTION"); > > global $input_label, $fp; > > if (!$fp) { > > echo("No connection!"); > > } else { > > $msg = $input_label->get_text(); > > echo("MSG: $msg\n FP: $fp\n"); > > fputs($fp, $msg); > > } > > } > > > LOL, I just created a little global variable boolean that does all the > job :) > But I still have two problems: > sending input data when enter key is pressed > when I close the window my loop (while $fim != 1) dosen't die, > I put $fim = 1 on destroy function, but dosen't worked at all. Where > sould I > put a and to this? > Or there is a way to verify if a gtk element still exist (isn't > destroyied)? So > I could verify if window1 still exists, if not, stop my loop. > > -- > Iuri Fiedoruk, Santa Maria, RS, Brasil. > > > > > -- > PHP-GTK General Mailing List (http://gtk.php.net/) > To unsubscribe, e-mail: php-gtk-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-gtk-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

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