[fpc-pascal] Make TStringList.ExchangeItems virtual?
pascaldragon at googlemail.com
Wed Feb 13 15:56:09 CET 2013
On 13.02.2013 15:43, Bart wrote:
> Is it at all feasible to make TStringList.ExchangeItems a virtual method?
> In Lazarus we have a component (TValueListEditor) that has a
> TStringList descendant as one of it's properties.
> This particular list needs te bee in sync with another list of objects.
> For Insert, Delete, Exchange and Clear that is easily done.
> However sorting is a problem, because CustomSort calls QuickSort which
> internally uses ExchangeItem() and not Exchange (which is virtual).
> For now I just duplicated the QuickSort and replaced ExchangeItem with
> (the overridden) Exchange.
> This however has the distinct disadvantage of having duplicate code.
And it calls OnChanging and OnChange and notifies the observers each
time an item is swapped... (at least if the Sort is not done inside a
So in that case I'd prefer the "virtualisation" of ExchangeItems as well...
More information about the fpc-pascal