[Gtk-sharp-list] TreeView Model and GetIter/GetValue

Rob Hudson rob at euglug.net
Wed Jul 6 01:35:19 EDT 2005


I'm new to the list and was inspired by Nat's screencast on how easy it 
looked using Glade and Gtk# so I'm attempting a small app.

I'm getting an error when I try to get a handle on the model used in the 
Main.cs(77) error CS0165: Use of unassigned local variable `recipetree'
Main.cs(78) error CS0165: Use of unassigned local variable `m'
Main.cs(79) error CS0029: Cannot convert implicitly from `object' to 

There's other errors but I can't seem to get past the error on line 77. 
  The variable recipetree is accessible in my MainClass constructor 
where I've used it to load values into the tree using AppendColumn(...).

Any help would be appreciated.

Here's my code with pieces removed for clarity...

using System;
using Gtk;
using Glade;

class MainClass
	[Widget] Gtk.TreeView recipetree;

	public static void Main(string[] args)
		new MainClass(args);

	public MainClass (string[] args)
		Glade.XML gxml = new Glade.XML("trv.glade", "mainWindow", null);
		// code snip //
	static void on_recipetree_row_activated(object o, RowActivatedArgs args)
		Console.WriteLine("Row activated");
		TreeIter iter = new TreeIter();
		TreeModel m = recipetree.Model;
		m.GetIter(iter, args.Path);
		string col0 = m.GetValue(iter, 0);
		Console.WriteLine("Column Value: {0}", col0);


More information about the Gtk-sharp-list mailing list