Forum > LCL

Suggestion on TExtendedStringList


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:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---  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.

New zip-file with updated recordstrings.diff created with rev64027 due to changes in LazUtils.lpk and .pas.


[0] Message Index

Go to full version