Scrolling to end of scrolled window when first displayed



I have a GtkTextView displaying some text - actually a log file in a
Scrolled Window.

I should like it to start off with the scroll at the bottom of the file
- i.e. showing the most recent entry in the log file.

How do I do this?

I have tried:

GtkAdjustment *adj =
gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(scroll));
gdouble val = adj->upper - adj->page_size;
if  (val < adj->lower)
        val = adj->lower;
gtk_adjustment_set_value(adj, val);

and also

gtk_text_buffer_get_end_iter(textbuf, &iter);
gtk_text_view_scroll_to_iter(GTK_TEXT_VIEW(view), &iter, 0.0, FALSE,
0.0, 1.0);

But neither work initially - however they do work in callbacks once the
window is up and running.

Is there some "first time display" signal I need to put one of those in?

Thanks for any help.

John Collins Xi Software Ltd www.xisl.com




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