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: Mike Woodworth <mike at divergentmedia dot com>
Date: Fri, 29 Sep 2006 20:24:17 -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> <561CF0CA-F9FA-4A8E-A730-5B65B25E58EB at mac dot com>

the better way to do it is make the array as you state in 1, then use the sortwith function.

mike
--
Mike Woodworth
mike at divergentmedia dot com


On Sep 29, 2006, at 8:00 PM, John Kubie wrote:

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>