[Gtk-sharp-list] Question about TreeNode
Mike Kestner
mkestner at novell.com
Fri Oct 21 10:42:20 EDT 2005
On Fri, 2005-10-21 at 11:49 +0200, Arrigo Razzini wrote:
> <snippet>
> TreeViewColumn column = new TreeViewColumn();
> ...
> column.AddAttribute (cellPixbuf, "pixbuf", 0);
> column.AddAttribute (cellText, "text", 1);
The above says "use model column 0 for the pixbuf attr and model column
1 for the text attr."
> ....
> store.AppendValues (new Gdk.Pixbuf("image.png"), "hello world");
> </snippet>
>
> .. but now I'm trying to use a NodeView/NodeStore instead of
> TreeView/TreeStore and I don't understand as it is possible to make
> the same without creating another Column in the TreeNode.
>
> <snippet>
> [TreeNode (ColumnCount=1)]
This is the number of "model" columns. So make it 2.
> public class GenericNode : TreeNode {
>
> string name;
>
> public GenericNode (string name)
> {
> this.name = name;
> }
>
> [TreeNodeValue (Column=0)]
Mark the property exposing the pixbuf as Column=0 and change this to
Column=1, since it is the text.
> public string Name
> {
> get { return name; }
> }
> }
> is it possible to have two or more CellRenderer for the same Column
> using a TreeNode ?
Sure, you are just confusing model columns with view columns.
--
Mike Kestner <mkestner at novell.com>
More information about the Gtk-sharp-list
mailing list