Re: Scrolling to end of scrolled window when first displayed



There is an example of scrolling a GtkTextView to the end at http://www.gtkforums.com/about1307.html

If it's not working "initially" but works in callbacks, perhaps that is because the widget isn't shown yet.

After the text view and scrolled window have been shown, do

while (gtk_events_pending()) gtk_main_iteration ();

before trying to scroll to the end.

Or perhaps try connecting to the text view's "show" or "realized" signals. Not sure if that would work but it's an idea anyway.

- Micah Carrick

 Developer - http://www.micahcarrick.com
 GTK+ Forums - http://www.gtkforums.com



John M Collins wrote:
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

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




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