EnableMethodErrors (ImageList Control) example for Delphi
procedure TForm1.LEADImgList1Click (Sender: TObject);
var
lIndex : LongInt;
MousePoint : TPoint;
begin
GetCursorPos(MousePoint);
MousePoint := LEADImgList1.ScreenToClient(MousePoint);
if LEADImgList1.AllowSelection = ALLOWSELECTION_NONE then {manual selection?}
begin
LEADImgList1.EnableMethodErrors:= False;
lIndex := LEADImgList1.HitTest (MousePoint.x,MousePoint.y); {did we hit an item?}
LEADImgList1.EnableMethodErrors:= True;
if ((lIndex >= 0) and (lIndex < LEADImgList1.Count)) then
begin
{ set item as selected}
LEADImgList1.SelectAll (False);
LEADImgList1.Item [lIndex].Selected := True; {make sure the item is selected}
end
end
end;