[Gtk-sharp-list] Dynamically populating a TreeStore

Jonathan Pryor jonpryor@vt.edu
Mon, 16 Aug 2004 21:05:50 -0400


On Mon, 2004-08-16 at 13:38, Chris Ridd wrote:
<snip/>
> In my case I want to associate each node in the store with an LDAP
> connection; the node will know the name of the entry it represents, and will
> know if it knows about any subordinate entries in the LDAP directory.
<snip/>
> None of the examples I've looked at (monodoc, gtk-sharp/samples) seem
> terribly oriented towards data that isn't all known at model creation time.

Look at the ManagedTreeViewDemo.cs file.  The basic idea is that you:

 1. Store a custom data type in a TreeStore
 2. Set a custom cell renderer for the column to properly render the 
    custom data type used in (1).

You can also look at Type Reflector (Mono CVS module: type-reflector) in
displayers/gtk/GtkTypeDisplayer.cs.  Look at the TreeCell class and the
OnRenderCellText() function.

 - Jon