On Wed, 2005-08-03 at 22:43 +1000, [EMAIL PROTECTED] wrote: > I have the following private method in a databound Control, that I am > developing, using the GTK widgets. > > My problem is in the "case "System.Decimal":" section of the code. I am > unable to find a way of setting up to pass Decimal values to the Column > in question, so that I can later sort the Column on the numerical > values.
Right. The problem is that the sorting is happening in the underlying C code, but there's no C type that corresponds to System.Decimal, so if you put decimal values into the column, what actually gets stored is not the value itself, but just a pointer to a copy of it. You ought to be able to work around this by specifying a custom sort function for that column, with the ListStore's SetSortFunc() method. (If you're using gtk# 1.0, you need to make sure that the delegate you pass for sort_func doesn't get GC'ed. If you're using gtk# 2.3/2.5, then gtk# handles that for you automatically.) When you call store.GetValue() from the TreeIterCompareFunc, the decimal values will be unwrapped automatically, and you can compare them as decimals and return the right comparison value. -- Dan _______________________________________________ Gtk-sharp-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
