cocoa: clearing selection of ListBox is itemIndex is set to negative index

git-svn-id: trunk@61760 -
This commit is contained in:
dmitry 2019-08-27 17:51:50 +00:00
parent 5f10473e8d
commit e768107d9c

View File

@ -2194,8 +2194,13 @@ begin
list := GetListBox(ACustomListBox);
if not Assigned(list) then Exit();
list.selectRowIndexes_byExtendingSelection(NSIndexSet.indexSetWithIndex(AIndex), false);
list.scrollRowToVisible(AIndex);
if (AIndex < 0) then
list.deselectAll(nil)
else
begin
list.selectRowIndexes_byExtendingSelection(NSIndexSet.indexSetWithIndex(AIndex), false);
list.scrollRowToVisible(AIndex);
end;
end;
class procedure TCocoaWSCustomListBox.SetSelectionMode(const ACustomListBox: TCustomListBox; const AExtendedSelect, AMultiSelect: boolean);