tags:

views:

82

answers:

1

here is the code

public void Update(TravTasks.TravellerTask data)
{
 //UNDONE: this algorithm sucks
 TreeIter iter;
 if (this.tasks_tree_store.GetIterFirst(out iter))
 {
  string task_id = this.tasks_tree_store.GetValue(iter, 1).ToString();
  if (task_id.Equals(data.ID.ToString()))
  {
   this.tasks_tree_store.SetValue(iter, 0, data.TaskName);
   this.treeview3.ShowAll();
   return;
  }
  while (this.tasks_tree_store.IterNext(ref iter))
  {
   task_id = this.tasks_tree_store.GetValue(iter, 1).ToString();
   if (task_id.Equals(data.ID.ToString()))
   {
    this.tasks_tree_store.SetValue(iter, 0, data.TaskName);
    return;
   }
  }
 }
}
A: 
public void Update(TravTasks.TravellerTask data)
{
    TreeSelection tsel = this.treeview3.Selection;
    if (tsel != null)
    {
     TreeIter iter = new TreeIter();
     if (tsel.GetSelected(out iter))
     {
      this.tasks_tree_store.SetValue(iter, 0, data.TaskName);
     }
    }
}
Ronaldo Nascimento