LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-31-2012, 03:36 PM   #1
Hidden Windshield
Member
 
Registered: Jul 2010
Distribution: Fedora
Posts: 68

Rep: Reputation: 27
GTK: Scrolling a TreeView after adding items


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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
GTK refreshing a TreeView after a change Hidden Windshield Programming 0 06-09-2011 10:14 AM
[SOLVED] Python gtk.TreeView update ListStore Algis Programming 1 04-10-2011 04:17 AM
How to display a datasheet in GTK's treeview? wwx024 Programming 1 03-17-2010 01:36 AM
regarding gtk treeview swift2008 Programming 0 09-05-2008 12:18 AM
adding new items to katapult phoenixenigma Linux - Software 0 02-22-2006 03:37 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration