[Gtk-sharp-list] Tree selection

Pokey the Penguin pokey@linuxmail.org
19 Feb 2003 03:49:55 +0000


On Wed, 2003-02-19 at 03:19, George Farris wrote:
> OK how the heck do I get a selected row of text out of the TreeView
> widget?

TreeIter iter = new TreeIter ();
TreeModel model;
mytreeview.Selection.GetSelected (out model, ref iter);

You can then reference the iter to a hashtable of stored values to find
the object it's associated with.

> This widget is seriously complex and without good documentation it's
> extremely difficult.  Some of the gtk functions don't even map to the
> gtk# class functions.
> 
> I think who ever created the TreeView was on some bad drugs:-)

Because Gtk+ is developed by a distributed team, it's not entirely
consistent and some parts are more intuitive than others. There's not
much that can be done about it. TreeView isn't too bad once you start
working with larger datasets, but like all things, it can be a bit of a
pain to get started with.