Ok, as part of the user interface, I have a button, a TreeView inside a ScrolledWindow, and a ListStore holding data for the TreeView. When the user clicks the button, one or more items are added to the end of the ListStore*. For the sake of convenience, I want to scroll the ScrolledWindow to the bottom, to make the just-added item(s) visible.
My first attempt was to add
Code:
gtk_adjustment_set_value(gtk_scrolled_window_get_vadjustment(myScrolledWindow), G_MAXDOUBLE);
to the end of the button's "clicked" signal handler. But, the height of the TreeView isn't recalculated until after the handler returns, so the end result is that it scrolls so that the new items are just
below the visible portion of the window.
Is there any way I can force the TreeView to update its size before the handler returns? Failing that, is there any other way to do this?
Thanks.
* Well, actually, there's a TreeModelSort and TreeModelFilter between the ListStore and the TreeView. No rows are actually added to the store, the button just changes some values so that the selected rows make it through the filter, and are sorted last by the sort. I don't think it makes any difference, but it might, and better too much information** than not enough
** I didn't mean it like that. Get your mind out of the gutter.