[Gtk-sharp-list] Deleting a row from a Tree
Christian Ziegner
cziegner@gmx.de
Thu, 08 Jul 2004 23:25:24 +0200
Hi there.
I have a question regarding the TreeView Widget. I want to delete a row
from a tree by clicking on a button. My problem is, how can i get the
row which is selected by the user and is to be deleted. My GUI was
created with glade and thus i don't have the possibility to directly
access the column. Basically, one of my trees looks as follows:
[Glade.Widget] TreeView ActionTree;
(...)
TreeStore store6 = new TreeStore (typeof(string), typeof(string));
string[] aktivitaet = new string [] {"John Foo","bla","One
Some","doing"};
for (int i = 0; i<(aktivitaet.Length-1); i+=2)
{
TreeIter iter6 =
store6.AppendValues(aktivitaet[i+1],aktivitaet[i]);
}
ActionTree.Model = store6;
ActionTree.HeadersVisible= true;
ActionTree.AppendColumn("Taetigkeit", new CellRendererText(),
"text", 0);
ActionTree.AppendColumn("Bearbeiter", new CellRendererText(),
"text", 1)
(...)
The button I have tried with:
void AktionLoeschen_clicked (object o, EventArgs args)
{
Console.WriteLine("Aktion loeschen");
AktionTree.RemoveColumn(AktionTree.Selection.GetSelectedRows(out
store6));
}
Unfortunately, this does not work at all. The mcs complains about bad
arguments. Does anyone have an idea regarding my problem??? I'd greatly
appreciate ANY help...
Greetings,
Chris