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

Rob Hudson rob at euglug.net
Wed Jul 6 11:17:37 EDT 2005


That didn't help.  I still get the first two errors.  Line 77 is this line:
	TreeModel m = recipetree.Model;

It's thinking recipetree is unassigned, but yet in my constructor it has 
a value and I can use it.  Do I need to do anything special to make it 
global to all methods in the class?  Is "[Widget]" enough or do I need 
"[Glade.Widget]" or something?

Thanks,
Rob

Rodolfo Campero wrote:
> Hi,
> 
> On 7/6/05, Rob Hudson <rob at euglug.net> wrote:
> 
>>Hello,
>>
>>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
>>TreeView...
>>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
>>`string'
>>
>>There's other errors but I can't seem to get past the error on line 77.
> 
> 
> Try replacing:
>          [Widget] Gtk.TreeView recipetree;
> by
>          [Widget] Gtk.TreeView recipetree = null;
> 
> and
>                  string col0 = m.GetValue(iter, 0);
> by
>                  string col0 = (string)m.GetValue(iter, 0);
> 
> 
>>  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.
> 
>  
> I hope this helps.
> Happy hacking,
> Rodolfo
> 


More information about the Gtk-sharp-list mailing list