I often find myself in the situation that I am debugging what is going on in part of a stringlist, e.g. data is being manipulated in the range StringList[StartOfBlock] to StringList[EndOfBlock]. One or more variable indexes in that range might be available that I can quickly inspect or watch, e.g. StringList[LineNum], but it is cumbersome to inspect neighbouring strings in the range StartBlock/Endblock. I can add another watch on StringList[LineNum+1], or modify the expression in the Ctrl-F7 inspector, but that is so much work ;-(
I would love to have StringList[StartOfBlock] to StringList[EndOfBlock] in the IDE in view permanently. (And it would be very nice if that view changes when StartOfBlock/EndOfBlock changes, or if that view can be refreshed.)
How would I build something 'into the IDE' to accomplish that?
Create a global function:
function GetLines(AList: TStrings; AStart, AEnd: Integer): string;
var
I: Integer;
begin
Result := '';
for I := AStart to AEnd do
if I < AList.Count then
Result := Result + AList[I] + sLineBreak;
end;
You can watch this function: GetLines(StringList, StartOfBlock, EndOfBlock) but enable function execution in watch settings (Allow function calls checkbox).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With