[Gtk-sharp-list] Numeric sorts in Gtk.TreeView trusted sender for your account)

gtk-sharp-list.1.tracyanne at spamgourmet.com gtk-sharp-list.1.tracyanne at spamgourmet.com
Wed Aug 3 18:30:35 EDT 2005


Thanks, that works perfectly.

It's a little difficult trying to make sense of the Gtk Sharp classes,
as the Documentation is often missing. I often find myself going from
one "Documentation for this section has not yet been entered" to
another, and then spending significant amounts of time experimenting
with properties and methods, just to find out what they do. If I dind't
think Mono on Linux was really important, I'd propably go back to
programming .NET on Windows full time.


Regards

Tracy Barlow

On Wed, 2005-08-03 at 09:24 -0400, Dan Winship - danw at novell.com wrote:
> On Wed, 2005-08-03 at 22:43 +1000,
> gtk-sharp-list.1.tracyanne at spamgourmet.com 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  -  Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
> 


More information about the Gtk-sharp-list mailing list