I'm posting to this group because the origin of the problem is sorting
columns in a ListStore that is a model for a TreeView. I want to sort
a column of integers so I started writing a sortfunction:
public int int_compare(TreeModel m, TreeIter a, TreeIter b)
{
GLib.Value x = new GLib.Value();
GLib.Value y = new GLib.Value();
m.GetValue(a,3,ref x);
m.GetValue(b,3,ref y);
// At runtime the next two lines throw: Unhandled Exception:
//System.InvalidCastException: Cannot cast from source type to
//destination type.
int i = (int)(x.Val);
int j = (int)(y.Val);
// But x.Val does contain an integer that gets unboxed correctly
// here:
System.Console.WriteLine(">> " + x.Val + " <<");
// Never got this far...
//return i.CompareTo(j);
// This is for debugging
return 1;
}
It looks to me as if the cast should work. Any ideas? Also, if there
are sortfunctions out there for various types I'd appreciate a pointer
to them.
Thanks
Callum
begin:vcard
fn:Callum Bell
n:Bell;Callum
org:SeiraD, Inc.
adr:;;3900 Paseo del Sol;Santa Fe;NM;87507;USA
email;internet:[EMAIL PROTECTED]
tel;work:505 438 1881
tel;cell:505 690 9132
x-mozilla-html:FALSE
version:2.1
end:vcard
_______________________________________________
Gtk-sharp-list maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list