G'Day Pe3s,
I think you need to include some more information, if you really want any help.
Is "imageindex" a local variable you have created? Or is it some object's property or method?
Also, I might be helpful to specify what version of Lazarus / FPC you are using and what OS (& version) you are using.
cheers
S.