[Gtk-sharp-list] Using ListViews/TreeViews in Gtk#?

Lee Mallabone gnome@fonicmonkey.net
05 Mar 2003 15:13:15 +0000


On Wed, 2003-03-05 at 15:05, Charles-Louis wrote:
> Do I have to add the TreeStore manually into the Glade XML file?

No, the Glade XML file is purely for the user interface, nothing to do
with your model.

> I think the problem is coupled to the fact that I have the instruction
> 
> TreeView tv = new TreeView(myStore)
> 	--> maybe Glade did already create the TreeView, but did not attach it
> to the store, so the 'new' TreeView was not added to the window?

If you've named your treeview in glade as 'myTreeView' then you can do the following:

Glade.XML xml = new Glade.XML(..... you've done this already);

TreeView myTV = xml.GetWidget("myTreeView") as TreeView;
myTV.Model = myStore;

There are nicer ways to do this using the [GladeWidget] attribute, but in the interests of getting up and running quickly, the above will hopefully put you on the right path.

Hope that helps,

Lee.