Witam, mam taki kod, przy probie kompilacji otrzymuje błąd typu : [Error]For loop control variable must be simple local variable
procedure TForm.ListView1DblClick(Sender: TObject) ;
var
hts : THitTests;
ht : THitTest;
sht : string;
ListViewCursosPos : TPoint;
selectedItem : TListItem;
begin
//position of the mouse cursor related to ListView
ListViewCursosPos := ListView1.ScreenToClient(Mouse.CursorPos) ;
//double click where?
hts := ListView1.GetHitTestInfoAt(ListViewCursosPos.X, ListViewCursosPos.Y) ;
//"debug" hit test
Caption := '';
for ht in hts do
begin
sht := GetEnumName(TypeInfo(THitTest), Integer(ht)) ;
Caption := Format('%s %s | ',[Caption, sht]) ;
end;
//locate the double-clicked item
if hts <= [htOnIcon, htOnItem, htOnLabel, htOnStateIcon] then
begin
selectedItem := ListView1.Selected;
//do something with the double clicked item!
Caption := Format('DblClcked : %s',[selectedItem.Caption]) ;
end;
end;
nie wiem jak to naprawić ? pomoże ktoś ?? :)