[Gambas-user] How to sort an array?

ron ronstk at ...239...
Fri Feb 13 21:34:26 CET 2004


On Friday 13 February 2004 19:44, Joao Pinto wrote:
> Hello,
> adding spaces to tranforst an ascii sort into a numeric sort is kind of
> insane.
>

Adding leading zero's can also be done.
But it works very well and is SIMPLE as asked.

> You should implement one of the serval known sort mechanisms like you
> can/should do on any language.
>
> You can check them at:
> http://linux.wku.edu/~lamonml/algor/sort/sort.html
>
> The easiest to implement is "Bubble sort", if you need some help with
> the code I cand send an example.
>

The "Bubble sort" sort is well known to me.
Used it already 20 years back in assembly. 
May be for the user who did ask for a way to do it.

> Easiter than that just waiting for a sort type propertie on the listbox
> component to set numerical sort, but I dont think thats a common feature
> on a listbox :)
>

I hope this wil be implemented by QT, it must be done by the nearest part of 
the widget/control on the screen,  else re-sort before and re-fill is may be 
the only good way.

In MS ListView it can be done from C and VB with a API call for text,nummeric 
and date types and is supported by the comctr32.dll.
The file Explorer does it and is quick, less 2 second to fill and sort for 
5000 items (avg 2000/sec). Konqueror has already problems to build the list 
with the content of /usr/bin, 5 seconds for only 1300 items (avg 260/sec).
Doing this in gambas interpreted source swapping 5 columns and 1000 rows?
Your pleasure.

> Best regards,
>
> João Luís Marques Pinto
> PTlink Technical Administrator
> Lamego at ...99...
> http://www.ptlink.net
>

---
Ron





More information about the User mailing list