473,396 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

TList.Sort


I have a class that I designed that contains some objects in its fields,
that are derived from the TList class.

I want to use the TList Sort procedure to sort the items that are in the
derived class. The derived class has an extra field that specifies how to
sort the items.

The problem I have is in the implementation of the Sort method in the way
the class is implemented by Borland. The call to the Sort method must
pass in the name of a simple procedure. The procedure call then receives
the pointers to the two items that it must return the order of.

Why oh why could Borland have not implemented the sort procedure call as
an event procedure or allow a method of another object to be passed as
the parameter to the Sort call, because I want the sort procedure to be
able to read the extra field in my class so that it knows how to carry
out the sort.

As the sort procedure does not receive any information about the calling
object there are various un-OO fudges like global variables necessary to
enable the sort procedure to get this information which I would like to
eliminate.

The TStringList custom sort routine has a means of passing you
information about the list in question. Better still is the Compare event
handler in the TListView and TTreeView components. Why couldn't TList's
sort be implemented like one of these?

Nov 11 '05 #1
0 1564

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Kamilche | last post by:
I've written a generic sort routine that will sort dictionaries, lists, or tuples, either by a specified key or by value. Comments welcome! import types def sort(container, key = None,...
4
by: its me | last post by:
Let's say I have a class of people... Public Class People Public Sex as String Public Age as int Public Name as string end class And I declare an array of this class...
0
by: Sebastian Faust | last post by:
Hi, I read about the Loki::Factory and Loki::AbstractFactory in the book Modern C++ Design and couldnt figure out one thing: If I have several classes, for example the following hierarchie: ...
40
by: Elijah Bailey | last post by:
I want to sort a set of records using STL's sort() function, but dont see an easy way to do it. I have a char *data; which has size mn bytes where m is size of the record and n is the...
3
by: Seeker of the Unseen | last post by:
Hi All, I am new to C++. I am currently playing with Borland C++ builder, I am trying to use TList to put my objects inside it, but I don't seem to quite grasp the concept of it. Can anyone...
7
by: Stuart | last post by:
The stl::sort() that comes with Dev Studio 6 is broken (it hits the degenerate case in a common situation). I have a replacement. I would like to globally do "using namespace std; except use my...
7
by: DC Gringo | last post by:
I have a datagrid that won't sort. The event handler is firing and return label text, just not the sort. Here's my Sub Page_Load and Sub DataGrid1_SortCommand: -------------------- Private...
48
by: Alex Chudnovsky | last post by:
I have come across with what appears to be a significant performance bug in ..NET 2.0 ArrayList.Sort method when compared with Array.Sort on the same data. Same data on the same CPU gets sorted a...
1
by: teddarr | last post by:
I have a TList that returns several items in C#. I want to pull 3 entities from this tlist to assign to variables. 2 of the 3 will be displayed in a datagrid. How do I assign these values to the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.