Are the lack of the TStringList.Sorted
property and TStringList.Sort
method in WEB Core oversights or is there a Javascript problem behind this?
I have no idea what this is based on.
This code works as expected in TMS WEB Core:
var
sl: TStringList;
i: integer;
begin
sl := TStringList.Create;
sl.Add('Bruno');
sl.Add('Pieter');
sl.Add('John');
sl.Sort;
for i := 0 to sl.Count - 1 do
console.log(sl.Strings[i]);
sl.Free;
end;
and this code too:
var
sl: TStringList;
i: integer;
begin
sl := TStringList.Create;
sl.Add('Bruno');
sl.Add('Pieter');
sl.Add('John');
sl.Sorted := true;
for i := 0 to sl.Count - 1 do
console.log(sl.Strings[i]);
sl.Free;
end;
Well, my question came from the fact that in my WEB Core 2.6.1.0 sl.Sort
and sl.Sorted
both fetch up identifier not found "Sorted" (or "Sort")
errors from LSP and the compiler. Do I need to update my version?
EDIT: Oops, I had declared sl: TStrings;
and then sl := TStringList.Create
I need to revisit the difference I guess!
I got into this because I thought that TCombobox.Items.Sorted := True
should work and it doesn't.
I was misled by the fact that ComboBox1.Sorted := True
is legal in VCL, despite the fact that its Items
property is TStrings
, not TStringList
.
We will expose TWebComboBox.Sorted: boolean for VCL compatibility
Thank you, Bruno, that will simplify my code.