[Gambas-user] gb3: sorting an array-like structure

Kevin Fishburne kevinfishburne at ...1887...
Tue May 24 04:01:17 CEST 2011


On 05/09/2011 09:59 PM, Benoît Minisini wrote:
>> Think of it like a spreadsheet instead of an array. I need each "row"
>> sorted by the value in a "column". The two column values are
>> ObjectNumber and ObjectY and the row represents the array index.
>>
>> There's got to be something like this in GAMBAS, but if not I can start
>> Google searching sort algorithms and make a procedure.
>
> - Put the objects you have to draw on the screen in a temporary array.
> - Define the (X,Y) final coordinates in two object variables.
> - Implement the "_sort" special method in the object class.
>
> That way, you just have to call "Sort" to sort only the objects you want the
> way you want.

The documentation didn't do much to alleviate my confusion, so if anyone 
understands this could you please post the simplest example possible? A 
link to the documentation on the _sort special method might be enough (I 
couldn't find it). As a refresher I'm basically trying to sort an array 
by one of its elements, much like sorting a spreadsheet.

-- 
Kevin Fishburne
Eight Virtues
www: http://sales.eightvirtues.com
e-mail: sales at ...1887...
phone: (770) 853-6271





More information about the User mailing list