Re: [fpc-pascal] Elegant way to switch sort mechanism in TSortedCollection?

2014-03-13 Thread Jim Leonard
On 3/13/2014 3:49 PM, Frederic Da Vitoria wrote: You are sorting only for display purposes? No, re-sorting is part of the algorithm, which sorts a list of graphics elements and then inserts/splits/deletes the collection entries, and then repeats this process. The sort method can change each

Re: [fpc-pascal] Elegant way to switch sort mechanism in TSortedCollection?

2014-03-13 Thread Frederic Da Vitoria
2014-03-13 15:56 GMT+01:00 Jim Leonard : > On 3/13/2014 9:49 AM, Jim Leonard wrote: > >> On 3/12/2014 6:58 PM, Philippe wrote: >> >>> you could >>> >>> - store the actual collection to a TMemoryStream, >>> >>> - destroy the collection, >>> >>> - Load then a new collect to be sort with different me

Re: [fpc-pascal] Elegant way to switch sort mechanism in TSortedCollection?

2014-03-13 Thread Jim Leonard
On 3/13/2014 9:49 AM, Jim Leonard wrote: On 3/12/2014 6:58 PM, Philippe wrote: you could - store the actual collection to a TMemoryStream, - destroy the collection, - Load then a new collect to be sort with different method ... Yes, that's what I'm doing now for every re-sort. Actually, s

Re: [fpc-pascal] Elegant way to switch sort mechanism in TSortedCollection?

2014-03-13 Thread Jim Leonard
On 3/12/2014 6:58 PM, Philippe wrote: you could - store the actual collection to a TMemoryStream, - destroy the collection, - Load then a new collect to be sort with different method ... Yes, that's what I'm doing now for every re-sort. I'll check the source and see if I can override any of

Re: [fpc-pascal] Elegant way to switch sort mechanism in TSortedCollection?

2014-03-13 Thread Jim Leonard
On 3/12/2014 5:06 PM, Frederic Da Vitoria wrote: You (or the user) will never need to resotre the first order? I am asking because you could as well simply create one SortedCollection for each sort order and systematically insert each item in all those collections. The overhead would be in the in