Re: inserting text on votton in text box
| From: | Markus Fischer | Date: | Tue, 29 Jan 2002 20:49:07 +0000 |
| Subject: | Re: inserting text on votton in text box | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-1063@lists.php.net to get a copy of this message | ||
On Tue, Jan 29, 2002 at 06:29:05PM -0200, Iuri Fiedoruk wrote :
> Hi! I'm starting a telnet/moo/mud client with php-gtk and I have started
> with a little test:
> $fp = fsockopen($server_name, $port_nr, &$errno, &$errstr) or
> die("$errno: $errrstr");
> set_socket_blocking($fp, 0);
> for ($i=0; $i< 10; $i++) {
> $msg = fgets($fp, 100);
> $main_label->insert_text($msg,0);
> usleep(400);
> }
> $main_label is a text box done in glade as the rest of the elements.
> The thing is that this code adds text on $main_label on top, but I want
> it added on botton.
> So If I do a telnet for my machine instead of:
>
> Trying 127.0.0.1...
> Connected to localhost.
> Escape character is '^]'.
>
> I get:
>
> Escape character is '^]'.
> Connected to localhost.
> Trying 127.0.0.1...
>
> As the second line is inserted on top of first....
>
> As I have not found how to do it after searching for a time on google,
> mail lists, etc, I'm posting
> here for help.
> Anyone knows how I do text being inserted on botton? Thanks in advance.
Take a look at
http://developer.gnome.org/doc/API/gtk/gtkeditable.html#GTK-EDITABLE-INSERT-TEXT
especially this:
"position : an inout parameter. The caller initializes it to
the position at which to insert the text. After the call it
points at the position after the newly inserted text."
Just don't pass 0 ass second parameter but the length of the
current text in the GtkText (see get_chars() how to retrieve
the length).
- Markus
--
Please always Cc to me when replying to me on the lists.