[Gtk-sharp-list] ListStore AppendValues problem on windows

Andrew King andrew.king@optiver.com.au
Fri, 03 Sep 2004 11:35:52 +1000


I am trying to use a ListStore with a custom class using the gtk# 
version of windows available with installer. I am using .NET framework 
1.1, not mono.

The problem is, I try calling AppendValues(cell), where cell is my 
custom class, and I get a nullreferenceexception in GLib.set_Value
Is this a known problem? Is there any reason I can't store a custom 
class in a ListStore? (It doesn't inherit from GObject or anything, just 
a simple class)


private class TimedCell
        {
            private DateTime timestamp;
            private Gdk.Color color;
            private string text;

            public DateTime TimeStamp
            {
                get { return timestamp; }
                set { timestamp = value; }
            }

            public Gdk.Color Color
            {
                get { return color; }
                set { color = value; }
            }

            public string Text
            {
                get { return text; }
                set { text = value; }
            }
        }

store = new Gtk.ListStore
                        (
                            typeof(TimedCell)
                           
                        );

TimedCell cell = new TimedCell();
cell.Color = new Gdk.Color(0, 0xff, 0xff);
cell.Text = inst.Feedcode;
cell.TimeStamp = DateTime.MinValue;
store.AppendValues(cell); // Null ReferenceException here


Regards,
Andrew