[Gambas-user] ListBox numeric sorting

timothy timothy.marshal-nichols at ...247...
Sun Jul 15 11:03:17 CEST 2007


Hello,

I wanted to sort some numbers in a ListBox by setting the Sorted
property to true. Alas I am having some trouble getting usable results.

Example 1:
Take the numbers: "1", "45", "234", "1234"
This will be sorted (correctly) in the ListBox according to the ASCII
sort order. But it is not that useful when you want to display a long
list of numbers.

Example 2:
Take the numbers: "0001", "0045", "0234", "1234"
This will be sorted (correctly) according to the ASCII sort order.
Numbers will be in the correct order. But it is not very readable.

Example 3:
Take the numbers: "   1", "  45", " 234", "1234"
This is the one I want. Numbers have been padded with spaces. But it
gives the same sort order as example 1!!! They are NOT in the correct
ASCII sort order! The spaces appear to have been removed before sorting.

Example 4:
Take the numbers: "...1", "..45", ".234", "1234"
Oddly gives the same sort order as example 1. The same goes for any
other non alphanumeric characters e.g.: /#&.=

Example 5:
Take the numbers: "AAA1", "AA45", "A234", "1234"
This gives the correct ASCII sort order. (Obviously not in the numeric
sort order.) But, of course, it is not very useful.

It's almost as if all non alphanumeric characters are removed from the
strings before sorting. This makes it almost impossible to sort numbers
readably. And it can give odd results when sorting other strings in a
ListBox.

Also I have had the same problems with the ColumnView.

Thanks

8-{)} Timothy Marshal-Nichols
<mailto: timothy.marshal-nichols at ...247...>
 







More information about the User mailing list