[Gtk-sharp-list] Howto use Treeview Cell Data Function
Jonathan Pryor
jonpryor@vt.edu
Sun, 25 Jan 2004 02:03:15 -0500
You could take a look at Type Reflector (Mono CVS module:
type-reflector) for some TreeCellDataFunc use.
You'll want to see displayers/gtk/GtkTypeDisplayer.cs, in the
OnRenderCellText and OnRenderCellIcon methods.
A sample implementation would be:
private void MyCellDataFunc_Column1 (
Gtk.TreeViewColumn tree_column,
Gtk.CellRenderer cell,
Gtk.TreeModel tree_model,
Gtk.TreeIter iter)
{
complexObject co = (complexObject)
tree_model.GetValue (iter, 0);
((CellRendererText) cell).Text = co.firstString;
}
You would need to use a different function for each column you wanted
rendered.
- Jon
On Sat, 2004-01-24 at 08:05, John BouAntoun wrote:
> Hey guys,
>
> I have treeview that has a liststore of complex objects.
>
> I wanted to map some text cell renderers to different string properties
> of the complex object.
>
> I figured out that I need a CellDataFunction and have the signature
> correct, but I have no idea what to do inside the CellDataFunction to
> get it to render properly.
>
> Some help (an example even) would be much appreciation.
>
> For simplicity's sake lets just say the complex object looked something
> like this
>
> class complexObject {
> string firstString {get;};
> string secondString {get;};
> }
>
> how would I get those two properties to render in the separate columns
> of a treeview?
>
> Thanks in advance
>
> JBA
>
>
> _______________________________________________
> Gtk-sharp-list maillist - Gtk-sharp-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list