[Gtk-sharp-list] Bug with marshalling types into a TreeStore column of type object

Chris Seaton chris at chrisseaton.com
Thu Nov 23 12:50:02 EST 2006


I have a TreeStore with a column of type object. When I try to store  
a bool or int, or presumably other basic types, it causes an error.  
If I wrap the same values into a new class, it works fine.

I've included a test program. I get the output

(<unknown>:693): Gtk-WARNING **: gtktreestore.c:822: Unable to  
convert from gboolean to GtkSharpValue
(<unknown>:693): Gtk-WARNING **: gtktreestore.c:822: Unable to  
convert from gint to GtkSharpValue

I'm using 1.1.18.0 on a PowerPC mac.

Thanks.

Chris Seaton

------------

mcs -pkg:gtk-sharp-2.0 test.cs
mono test.exe

-----------

using System;

using Gtk;

class GtkProofBox
{
     public object obj;
}

class Test
{
     public static void Main(string[] args)
     {
         Application.Init();

         TreeStore store = new TreeStore(typeof(object));

         // These cause an error

         store.AppendValues(true);
         store.AppendValues(14);

         // These do not

         GtkProofBox box1 = new GtkProofBox();
         box1.obj = true;
         store.AppendValues(box1);

         GtkProofBox box2 = new GtkProofBox();
         box2.obj = 14;
         store.AppendValues(box2);
     }
}



More information about the Gtk-sharp-list mailing list