Web lists-archives.org

Re: Scroll to bottom of window...




You can also try getting the insert mark and then scroll to visible area 
of the textview using gtk_text_view_scroll_to_mark .

 GtkTextMark "insert" can be retrieved like this :
 insert =gtk_text_buffer_get_insert (buffer);

Regards,
Sanny

Kalle Vahlman wrote:
> 2008/4/22, David Conley (FRD) <dconley@xxxxxxxxx>:
>   
>> I'm trying to write a app that has a small text window that fills with
>>  text from another thread. Its all working fine but the text is dropping
>>  off the end of the window. Really what I'd like is for the scroll window
>>  the text view is in to automatically scroll to the bottom to show the
>>  latest message added. I suspect I need to use
>>  gtk_scrolled_window_set_vadjustment(GTK_SCROLLED_WINDOW(scroll), adj);
>>  but what I set my adjustment to I have no idea. Anyone got any tips.
>>     
>
> What you rather want to do is to _get_ the vadjustment (which is a
> GtkAdjustment object) and set it's value to the upper bound of it
> (which translates to "the scrollbar to the end position"). Something
> like this:
>
>   vadj = gtk_scrolled_window_get_vadjustment(swin);
>   gtk_adjustment_set_value(vadj, vadj->upper);
>
> Depending on the widget you use, there might be even better ways to do
> this, but this should work if you always just want to go to the end.
>
>   
_______________________________________________
gtk-devel-list mailing list
gtk-devel-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-devel-list