[Gtk-sharp-list] Treeview iteration

Simon Guindon simon@nureality.ca
Fri, 25 Apr 2003 15:56:35 -0400


I'm sorry I really don't follow this code sample.  I've been trying to
work with it for a few days and I'm racking my brain bigtime.  Why can't
this stuff be a collection of nodes or something?  A simple recursive
method with a for loop would be so much easier, looks like you have
methods to iterate next, check if theirs children etc.

I'm starting to think the others asking for more C# integration may be
right.  I find it much more appealing to do something like this:

Mytreeview.Nodes - a collection of root nodes
Mytreeview.Nodes[0].Childnodes - a collection of child nodes
MyTreeview.Nodes[0].Childnodes[0].Childnodes - etc etc big tree of nodes

Other properties that would be helpful is like .HasChildren, etc.  I
don't know, I hate to complain like this, I really feel bad, but I feel
the learning curve on this stuff when you don't have any GTK background
pretty tough.  I just want to loop through the freaking nodes! Lol
sorry.

On another note, has anyone taken a look at my post about the
glade-sharp problems on win32 via .NET framework?  I haven't seen any
responses at all.

Take care,
Simon

-----Original Message-----
From: gtk-sharp-list-admin@lists.ximian.com
[mailto:gtk-sharp-list-admin@lists.ximian.com] On Behalf Of Gonzalo
Paniagua Javier
Sent: April 23, 2003 4:59 PM
To: gtk-sharp-list@lists.ximian.com
Subject: Re: [Gtk-sharp-list] (no subject)


El mi=E9, 23 de 04 de 2003 a las 22:55, Simon Guindon escribi=F3:
> How does one iterate the nodes in a TreeView in GTK#?  I want to be=20
> able to loop through them, find the row I'm looking for via reading=20
> the value of the column in that row.
>=20
> I know how to read a column from a row:
>=20
> tvFriendsList.Selection.GetSelected(out model, ref iter);=20
> model.GetValue(iter, (int)ColumnId.JID, out val);
>=20
> But not example sure how to loop through them all.

I do this in nunit-gtk:

	void GrayOut (TreeIter iter)
	{
		SetValue (iter, 0, grayCircle);
		TreeIter child;
		if (!IterChildren (out child, iter))
			return;
		do {
			GrayOut (child);
		} while (IterNext (out child));
	}

If the 'iter' parameter is the first node, this method traverses all of
its childrens.

-Gonzalo


_______________________________________________
Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list