🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.delphi.misc
Article #447

Re: Sorting of 4 String-Lists

#447
From: Tom de Neef
Date: Thu, 16 Sep 2004 08:33
43 lines
2846 bytes
"Christian Hartmann" <cha@christian-hartmann.de> schreef in bericht
news:7c275508.0409150941.6f82c64e@posting.google.com...
> Dear all,
>
> I have got 4 StringLists that are connected via the Index (all data in
> the 4 string-lists with the same index are one whole business
> information). Now I want to sort 3 of them based on the sorting of
> one. Does anyboday have got a pattern how to do this?
>
> Example:
>
> The second string-list is taken to be sorted alphabetically. Now the
> 1st, 3rd, and 4th String-List should be sorted liek the second one
> based on the index.
>
> So, does anyboday have got a pattern how to do this?
>
> Any help will be appreciated. Thank you in advance.
>
> Regards,
>
> Christian Hartmann

What you do seems very dangerous and error-prone. Any change in one of the
stringlists must be reflected in the three others (insert, delete, change
order). Sooner or later you will resent the approach.
I can see three alternatives:
a) disband the four stringlists and introduce a new recordbased Tlist
instead, containing the four strings.
b) construct one new record out of the four strings upon loading. And put
these records in their own Tlist. Upon saving you can split them out again
into four stringlists. No problems with insertion, deletion and
interchanging.
c) link the strings in the Tstringlists via a common object. Each
Tstringlist has an Objects property and each string in the list can be
associated with an object. So: create a link record (object) with pointers
to the four strings that belong together and associate the four strings with
this object. Sorting of one list will not affect the association of the
strings with their objects and thus with their couterparts in the other
lists. But deletion and insertion are to be considered as well. All in all:
much more complex than a) or b).

Tom
Technical Details
Message-ID: <41494fd4$0$34762$e4fe514c@news.xs4all.nl>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeeder.wxs.nl!transit.news.xs4all.nl!not-for-mail
References: <7c275508.0409150941.6f82c64e@posting.google.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10baee,d732bf8359cf86fd
X-Google-Thread: fb0ea,d732bf8359cf86fd
X-Google-Attributes: gid10baee,gidfb0ea,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeeder.wxs.nl!transit.news.xs4all.nl!not-for-mail
From: "Tom de Neef" <tdeneef@qolor.nl>
Newsgroups: comp.lang.pascal.delphi.misc,borland.public.delphi.vcl.components.using
References: <7c275508.0409150941.6f82c64e@posting.google.com>
Subject: Re: Sorting of 4 String-Lists
Date: Thu, 16 Sep 2004 10:33:23 +0200
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
Lines: 46
Message-ID: <41494fd4$0$34762$e4fe514c@news.xs4all.nl>
NNTP-Posting-Date: 16 Sep 2004 10:33:24 CEST
NNTP-Posting-Host: 213.84.188.25
X-Trace: 1095323604 news.xs4all.nl 34762 [::ffff:213.84.188.25]:10323
X-Complaints-To: abuse@xs4all.nl