Re: [gtk-list] Problems with the vadj of a text widget



On Wed, 5 Apr 2000, Jeff Shipman wrote:

> I'm using the following code to insert text into a text widget which
> holds a log. The only problem I'm having is making it so the vertical
> scrollbar follows the text all the way at the bottom. The text widget is
> not editable so I think that's why it's not following it automatically.
> I'm using the following code to insert text and try to keep my
> adjustment bar all the way at the bottom, but unfortunately it doesn't
> quite hit the bottom. It scrolling all of the text, but there's always
> an extra blank line at the bottom so the scrollbar doesn't go down all
> the way. Did I explain that well enough? Anyway, what could I do to
> ensure that the vertical scrollbar will always be at the bottom? Thanks.
> 
>    gtk_text_freeze(GTK_TEXT(log));
>    gtk_text_insert(GTK_TEXT(log), NULL, &color, NULL, message, -1);
>    gtk_text_set_point(GTK_TEXT(log),
> gtk_text_get_length(GTK_TEXT(log)));
>    gtk_adjustment_set_value(GTK_TEXT(log)->vadj,
> GTK_TEXT(log)->vadj->upper);
>    gtk_text_thaw(GTK_TEXT(log));

  Just a suggestion: does your text end with newline ('\n')? Could you try 
 to insert text without '\n' at the end?

> -- 
> +-----------------------------------------------------+
> | Jeff "Shippy" Shipman     E-Mail: shippy@cs.nmt.edu |
> | Computer Science Major    ICQ: 1786493              |
> | New Mexico Institute of Mining and Technology       |
> | Homepage: http://www.nmt.edu/~shippy                |
> +-----------------------------------------------------+
> 
> -- 
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
> 

 Best regards,
  -Vlad



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]