Reputation: 1571
Here is the code:
protected virtual void OnTreeview3CursorChanged (object sender, System.EventArgs e)
{
TreeSelection selection = (sender as TreeView).Selection;
TreeModel model;
TreeIter iter;
// The iter will point to the selected row
if(selection.GetSelected(out model, out iter))
{
int selected_id = -1;
string select_path = model.GetPath(iter).ToString();
if (select_path.Contains(":")) {
return;
}
else {
selected_id = int.Parse(select_path);
}
TravTasks.TravTaskEditWidget task_edit_widget =
new TravTasks.TravTaskEditWidget(new TravTasks.TravellerTask(select_path));
All I want is the text at the selected item, not its index number.
Upvotes: 0
Views: 1790
Reputation: 1571
I forgot this was answered here: http://lists.ximian.com/pipermail/gtk-sharp-list/2009-July/009796.html
So the answer is:
Console.WriteLine (model.GetValue (iter, 0);
Upvotes: 1