I have a TListBox on a form, and items are added with
listbox1.ItemIndex := listbox1.Items.AddObject('msg', TObject(grp));
grp is an integer,
The listbox is set to lbOwnerDrawFixed
In the onDrawItem event i get the Exception EStringListError raise on the marked line
msg := (control as Tlistbox).Items.Strings[index]; <-- this line works
grp := integer((control as Tlistbox).Items.Objects[index]); <--- Exception here
msg and grp are local string and integer variables
Project ### raised exception class EStringListError with message 'List index out of bounds (1)'