realbasic-nug
[Top] [All Lists]

Re: How do you sort Object arrays?

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: How do you sort Object arrays?
From: John Kubie <jkubie at mac dot com>
Date: Fri, 29 Sep 2006 20:00:07 -0400
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <C491F54F-2391-4E85-B2D1-6F856F4ADF15 at mobleybros dot com>
I'm really over my head here, but how about this:

1. In parallel with the object array, make a 1-dimensional array of the variable you want to sort on. 2. make a dictionary with paired elements: 1-dimensional array element -- associated object

Then, when you want to sort, sort the 1-d array.To address a sorted element, get the element from the 1-d array and look up its associated object in the dictionary.

John Kubie

On Sep 29, 2006, at 7:41 PM, Phil M wrote:

Is is possible to add a Sort function to an Object array? Can I get sorts to work if the Object supports something like a "Sortable" interface? For example:

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>