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

Fabien Bodard gambas.fr at ...626...
Thu May 5 12:31:53 CEST 2011


2011/5/5 nando <nando_f at ...951...>:
> It depends how you declare the 2D string array.
>
> If the first dimension is an Object[]
> and you add a String[] in each element
> to make the second dimension,
> then you can sort the second dimension as a 1D string.
>
>
> ---------- Original Message -----------
> From: Kevin Fishburne <kevinfishburne at ...1887...>
> To: gambas-user at lists.sourceforge.net
> Sent: Thu, 05 May 2011 01:46:22 -0400
> Subject: Re: [Gambas-user] gb3: sorting an array-like structure
>
>> On 05/05/2011 01:39 AM, nando wrote:
>> > ?
>> > Do you mean sorting [0, 1] to [1000, 1]
>> > Because the 1 is the second element of the second dimension
>> > ??
>>
>> We are misunderstanding each other. I know arrays start at zero when
>> referencing their elements and dimensions outside of the declaration. By
>> second element, I mean the number one. That's not really relevant,
>> though, as I'm basically asking if there is a method to sort an array
>> without creating an elaborate sorting procedure. Is there a mechanism
>> for sorting an array, or an array-like structure, inherent in GAMBAS or
>> do I need to sort manually?
>>
>> --
>> Kevin Fishburne
>> Eight Virtues
>> www: http://sales.eightvirtues.com
>> e-mail: sales at ...1887...
>> phone: (770) 853-6271
>>
>> ------------------------------------------------------------------------------
>> WhatsUp Gold - Download Free Network Management Software
>> The most intuitive, comprehensive, and cost-effective network
>> management toolset available today.  Delivers lowest initial
>> acquisition cost and overall TCO of any competing solution.
>> http://p.sf.net/sfu/whatsupgold-sd
>> _______________________________________________
>> Gambas-user mailing list
>> Gambas-user at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
> ------- End of Original Message -------
>
>
> ------------------------------------------------------------------------------
> WhatsUp Gold - Download Free Network Management Software
> The most intuitive, comprehensive, and cost-effective network
> management toolset available today.  Delivers lowest initial
> acquisition cost and overall TCO of any competing solution.
> http://p.sf.net/sfu/whatsupgold-sd
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>


We use that to sort icons in the iconview component

take a look in the source

trunk/comp/gb.form

IconView.class



This use the compare event and the comp function. to compare each
object text to sort the object in the array.

http://gambasdoc.org/help/lang/comp?v3
http://gambasdoc.org/help/lang/special/compare?v3
-- 
Fabien Bodard




More information about the User mailing list