LCL: TCustomListView: allow to change ItemIndex in OwnerData mode. issue #19825

git-svn-id: trunk@35264 -
This commit is contained in:
zeljko 2012-02-09 11:37:10 +00:00
parent 3603901d03
commit 353087a643

View File

@ -1193,10 +1193,20 @@ procedure TCustomListView.SetItemIndex(const AValue: Integer);
begin
if (AValue < -1) or (AValue >= Items.Count) then
raise Exception.CreateFmt(rsListIndexExceedsBounds,[AValue]);
if OwnerData then
FSelectedIdx := AValue;
if AValue = -1 then
Selected := nil
else
Selected := Items.Item[AValue];
begin
Selected := nil;
end else
begin
// trigger ws selection update, it'll update Selected too
if OwnerData then
Items.Item[AValue].Selected := True
else
Selected := Items.Item[AValue];
end;
end;
{------------------------------------------------------------------------------