On Wed, 2007-05-02 at 14:18 +0400, Oleg Ignatov wrote: > Hello, All. > How can I get index of the selected row in TreeView element? > So I click on the row, and want to get index of selected item. How can > I resolve this problem?
Using Selection.GetSelected
protected Task GetSelectedTask(TreeView _view)
{
TreeIter iter;
TreeModel model;
TreeSelection selection;
Task task;
task = null;
if(_view.Selection.GetSelected(out model, out iter))
task = (model.GetValue (iter, 0) as Whitemice.ZOGI.Task);
return task;
} /* End GetSelectedTask */
In the above example the treeview has a store of Task objects:
taskStore = new ListStore(typeof(Task));
What you get out of the TreeView of course depends on what you put in
it.
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Gtk-sharp-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
