You are trying to access the Items which is an indexed property, not a method with IDX as an argument.
Therefore the usage of .Items(IDX) needs to be replaced with .Items[IDX]. Your code:
For IDX := lstHangar.Items.Count - 1 downto 0 do
Linetext := lstHangar.Items(IDX); // <<<<<< Use [] brackets here instead of ()
WriteLn(aFile, Linetext);
So, just use square brackets instead of plain, round brackets.
There is also a problem with your loop. Your code:
For IDX := lstHangar.Items.Count - 1 downto 0 do
Linetext := lstHangar.Items(IDX);
WriteLn(aFile, Linetext);
You will only write the the Linetext variable in the last iteration of the loop.
You should have two lines of code in the loop body, but you only have one.
That's because you forgot to wrap these two lines with begin/end pair.
For IDX := lstHangar.Items.Count - 1 downto 0 do
begin
Linetext := lstHangar.Items(IDX);
WriteLn(aFile, Linetext);
end;
And your iteration with downto will cause that you have the lines of text in the reverse order, because you are iterating from last to first item, but maybe it is what you want? Your code:
For IDX := lstHangar.Items.Count - 1 downto 0 do
If you need to have the real dump (not reversed order) you should use normal loop from first to last item:
For IDX := 0 to lstHangar.Items.Count - 1 do
BTW, you can try to use built-in functions of the TStrings class to save to file.
lstHangar.Items.SaveToFile();