Auto scrolling to the end of a Gtk.NodeView

Here is how you add an item to a NodeView and auto-scroll right to it. I’ll assume you have read this tutorial and are not a total newcomer to NodeView. Using the example from the tutorial, here is how you auto-scroll to the item just added:

MyTreeNode node = new MyTreeNode ("The Beatles", "Yesterday");
view.ScrollToCell(new TreePath(new int[] {_n-1}), null, false, 0, 0);

Here, _n is the number of rows you have in the NodeStore. It can be a private attribute that should be incremented by 1 when a new row is added, and decremented when a row is removed.

That’s all there is to it!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s