Try to print index in popup of showmessage gives an compile time error.
[dcc32 Error] Unit.pas(57): E2003 Undeclared identifier: 'IntToStr'
In my code I am using ShowMessage(IntToStr(J)); J is an integer.
ShowMessage(IntToStr(J));
You have to add the SysUtils unit to your calling unit's uses clause.
SysUtils
uses