Forum > LCL
[soled] StringList.CustomSort - how to migrate from Delphi?
Nicole:
To me the problem seems quite obvious (what may be my fault):
The parameters of the declaration are 3 of them, the call contains only one parameter.
Any ideas, how I can change the call?
(who suspects, I have not understood customsort in the depth is right)
bytebites:
The compare function can't be instance function. Move it away from the frame.
--- 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";}};} ---function StringListSortComparefn2(List: TStringList; Index1, Index2: Integer): Integer;
KodeZwerg:
--- Quote from: Nicole on September 09, 2022, 04:24:55 pm ---To me the problem seems quite obvious (what may be my fault):
The parameters of the declaration are 3 of them, the call contains only one parameter.
Any ideas, how I can change the call?
(who suspects, I have not understood customsort in the depth is right)
--- End quote ---
--- 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";}};} --- SL_SUB.CustomSort(@StringListSortComparefn2);
Bitteschön :-*
rvk:
--- Quote from: KodeZwerg on September 09, 2022, 04:21:26 pm ---
--- Quote from: Nicole on September 09, 2022, 04:17:44 pm ---what H means
--- End quote ---
Hints :)
turn hints on/off
--- End quote ---
YIKES. No no.
https://www.freepascal.org/docs-html/prog/progsu25.html
{$H+} means Use AnsiStrings
For {$MODE DELPHI} the {$H+} is default and can be ommited.
For {$MODE OBJFPC} you do need {$H+} if you want to use AnsiStrings.
(To avoid confusion it's best to always put {$H+} after the $MODE switch)
BTW Hints is {$HINTS ON} or {$HINTS OFF}
https://www.freepascal.org/docs-html/prog/progsu27.html#x34-330001.2.27
marcov:
And delphi mode should not require a @. If so that is a bug, and you need to file it.
Navigation
[0] Message Index
[#] Next page
[*] Previous page