[Gtk-sharp-list] TreeViews and NodeViews. arg!

Adam Tauno Williams awilliam at whitemice.org
Wed Jan 21 16:57:17 EST 2009


> Adam Tauno Williams wrote:
> > Append an object to the model.
> um okay. :confused:

Its the lines like:

musicListStore.AppendValues ("Daft Punk", "Technologic");

in the tutorial
<http://www.mono-project.com/GtkSharp_TreeView_Tutorial#Mode>

or further down in the tutorial is the better way:

foreach (Song song in songs) {
  musicListStore.AppendValues (song);
}

where your store contains objects rather than columnar values.  The
downside of that is that you have make and attach render functions for
each column.

artistColumn.SetCellDataFunc (artistNameCell, new Gtk.TreeCellDataFunc
(RenderArtistName))

That works really well and gives you mucho flexibility/control but gets
pretty tedious and results in lots of 'plumbing code'.

That is the upside of the Hyena
<http://www.mail-archive.com/gtk-sharp-list@lists.ximian.com/msg03669.html> approach,  a column can be directly attached to an object property.

new Column ("Pears", new ColumnCellText ("C", true), 1),

 - the literal property "C" of the object in the store, via reflection,
is mapped to the column "Pears".


-- 
Adam Tauno Williams, Network & Systems Administrator
Consultant - http://www.whitemiceconsulting.com
Developer - http://www.opengroupware.org



More information about the Gtk-sharp-list mailing list