Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 2 of 2 total |
Sorting trouble |
Wed, Apr 19 2017 7:27 AM | Permanent Link |
Matthew Jones | I have a TObjectList derived list that I use for sorting. I am getting odd results, with the values not ending up as expected. I can't work out why. Anyone else use TObjectList and SortCompare? Is it working okay for you?
-- Matthew Jones |
Wed, Apr 19 2017 7:41 AM | Permanent Link |
Matthew Jones | Matthew Jones wrote:
> I have a TObjectList derived list that I use for sorting. I am getting odd results, with the values not ending up as expected. I can't work out why. Anyone else use TObjectList and SortCompare? Is it working okay for you? Okay, sussed it. I am used to sort functions that accept a difference, and use <0, 0 or >0 as their sort values. So a simple subtraction of two values is okay. However, the EWB sort is using a fixed -1, - or +1, and indeed the CompareStr function returns one of these two values. So in addition to my first line: result := xJobR.DeleteStatus - xJobL.DeleteStatus; // inverted I need to add this for numerical results: if result < 0 then Result := CMP_LESS else if result > 0 then Result := CMP_GREATER; -- Matthew Jones |
This web page was last updated on Tuesday, April 30, 2024 at 03:55 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |