Just trying to re-inject
this non-performing discussion at a more suitable place. Due to minor flaws of TExtendedStringList I'd like to make the following suggestion to the maintainers of LazUtils and StdCtrls:
- 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:
TCheckList = class(TCustomRecordStringList)
private
function GetCheckMode(Index: Integer): TCheckMode;
function GetCheckState(Index: Integer): TCheckState;
procedure SetCheckMode(Index: Integer; AValue: TCheckMode);
procedure SetCheckState(Index: Integer; AValue: TCheckState);
public
constructor Create; reintroduce;
property CheckMode[Index: Integer]: TCheckMode read GetCheckMode write SetCheckMode;
property CheckState[Index: Integer]: TCheckState read GetCheckState write SetCheckState;
end;
without confusing the user 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. TRecordStringList just exposes all properties needed to deal with 'unknown' records like in TCustomListBox.
- 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
I'm including recordstrings.pas and a recordstrings.diff created with rev 64001 so that these proposed changes can be tested with trunk.