Re: Scroll to the bottom

From: Date: Tue, 15 Mar 2005 18:38:50 +0000
Subject: Re: Scroll to the bottom
References: 1 2 3  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-5646@lists.php.net to get a copy of this message
It works Gonzalo ! BUT is there NO method to make this work without deleting the content and filling it again ? regards,
           Francisco
----- Original Message ----- From: "Gonzalo Monzón" <gmc@serveisw3.net> To: "Francisco barrio" <obarriof@fibertel.com.ar>; <php-gtk-general@lists.php.net> Sent: Tuesday, March 15, 2005 2:36 PM Subject: Re: [PHP-GTK] Scroll to the bottom
Francisco barrio escribió:
Hello folks.. thanks for the last answer of function 2 function. i dont find the way of make that the scrollbar goes to the bottom after i enter some data.. here is the code: $scroll= &new GtkScrolledWindow(); $scroll->set_border_width(5); $scroll->set_usize(100, 300); $scroll->set_policy(GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); $frame->add($scroll); $vbox = &new GtkVBox();
     $text = &new GtkText();
     $text->set_usize(246, 280);
     $text->set_editable(true);
     $scroll->add($text);
$frame->add($scroll); // then i have something like this $length = $text->get_length(); $text->freeze(); $text->insert_text("name: ". $nombre_final, $length); $text->thaw(); $length = $text->get_length(); $text->freeze(); $text->insert_text("\ndir: ".$dir_principal."\n\n", $length); $text->thaw(); ///////// my question is.. how do i make to do that the scrollbar goes down after i insert some text .. thanks in advice.
Hi Francisco, There's some work around this, and you can get the scroll down by adding and deleting a single char once the textbox is set with the text. Try this code: /* Funcion para llenar un gtktext
@param &$gtktext    GtkText
@param $value=null Valor */ function set_text_val(&$gtktext,$val) { // Limpia gtktext $gtktext->set_point(0); $gtktext->forward_delete($gtktext->get_length()); // $gtktext->insert(null, null, null, $val); // EN GtkTEXT: AÑADIR ESTAS LINEAS PARA FORZAR AUTOSCROLL... $gtktext->insert(null,null,null," ");
   $gtktext->backward_delete(1);       }
regards, Gonzalo


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