Re: refresh problem

From: Date: Fri, 23 May 2003 18:45:08 +0000
Subject: Re: refresh problem
References: 1 2  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-3475@lists.php.net to get a copy of this message
Is this really all the code? You never add the GtkText widget to the GtkWindow, therefor it never gets displayed. --rdp silver_dragoon said: > Well, > > I realize I wasn't clear at all, so I rewrote my code a little, and I > give it here, hoping someone will guess what's going wrong. > > I've tried many of your tricks, but none of them succeeded. > > I've put some gtk::main_iteration after the socket_read, but I doesn't > help me refreshing my display. > > So here is the code : > > class irc_connection > > { > > var $socket; > > var $console; > > var $usercommand; > > function irc_connection() > > { > > $window = &new GtkWindow; > > //here is the code building some widgets and the main window, > > $this->console = &new GtkText(); > > $this->console -> set_editable(false); > > $this->console -> set_word_wrap(true); > > //other stuff > > $window -> show_all(); > > } > > function irc_connect($server, $port) > > { > > $this->socket = socket_create(AF_INET,SOCK_STREAM,SOL_TCP); > > $connection = socket_connect($this->socket,$server,$port); > > socket_write($this->socket, "USER PHPGTK UNKNOW UNKNOW :silver_d\r\n"); > > socket_write($this->socket, "NICK :silver_d\r\n"); > > return true; > > } > > > function parse_server_msg($servermsg) > > { > > //réécrire le code car une seule ligne est transmise > > $commande = explode(' ', trim($servermsg)); > > if ($commande[0] == 'PING') > > { > > $reponse = "PONG ".$commande[1]."\r\n"; > > socket_write($this->socket, $reponse); > > echo $reponse; > > } > > } > > > function update_irc() > > { > > if ($datairc = @socket_read($this->socket, 10240)) > > { > > $stack = explode("\r\n", trim($datairc)); > > echo "$datairc"; > > foreach ($stack as $cle => $servermsg) > > $this->parse_server_msg($servermsg); > > $this->console-> insert($font, $color, null, $datairc); > > } > > while (gtk::events_pending()) gtk::main_iteration(); > > return true; > > } > > > function refresh() > > { > > $this->console->thaw(); > > while (gtk::events_pending()) gtk::main_iteration(); > > return true; > > } > > > function __sleep() > > { > > socket_close($this->socket); > > } > > } > > > > and the main code : > > > > include('classes.php'); > > set_time_limit(0); > > > if (isset($strStyle)) { > > GTK::rc_parse( GTK::rc_get_theme_dir() . "/" . $strStyle . > "/gtk/gtkrc"); > > } > > $ircserver = new irc_connection; > > $ircserver -> irc_connect('irc.epiknet.org', 6667); > > gtk::timeout_add('20', array(&$ircserver, "update_irc")); > > gtk::timeout_add('2', array(&$ircserver, "refresh")); > > gtk::main(); > > > > well... sorry for writing my code here but i really can't get it to > work... > > thank you a lot, again :) > > > > ++ silver_d > > > > -- > PHP-GTK General Mailing List (http://gtk.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- Rich Payne http://talisman.mv.com rdp at talisman dot mv dot com

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