Now what I'm trying to get at is a proposition as follows:
- rewrite TExtendedStringList to a new class TRecordStringList that corrects some minor flaws - for instance a CheckIndex as first line of CreateRecord so that no memory is allocated for an index that might not exist - and at the same time introducing a new ancestor class TCustomRecordStringList that can be used to descend lists that for example might look like this:
TCheckTreeList = class(TCustomRecordStringList)
private
function GetCheckMode(Index: Integer): TCheckTreeMode;
function GetCheckState(Index: Integer): TCheckTreeState;
procedure SetCheckMode(Index: Integer; AValue: TCheckTreeMode);
procedure SetCheckState(Index: Integer; AValue: TCheckTreeState);
public
constructor Create; reintroduce;
property CheckMode[Index: Integer]: TCheckTreeMode read GetCheckMode write SetCheckMode;
property CheckState[Index: Integer]: TCheckTreeState read GetCheckState write SetCheckState;
end;
without confusing or tempting the user (ie application developer) with the record properties or methods and without having to create a TObject descendant for those indexed properties.
- add RecordStrings to LazUtils and replace TExtendedStringList within TCustomListBox with TRecordStringList
- leave ExtendedStrings in LazUtils in case there is code out there that relies on the current layout of TExtendedStringList, but eventually mark it as deprecated
Where and how to make a propostion like that? Maybe Bart or someone else more involved with the interiors of Lazarus might advise...?
I'm including recordstrings.pas and a recordstrings.diff created with rev 63949 so it can be tested with trunk.