From c5100d475a1714a6b5f2fe9ef7758389fb558731 Mon Sep 17 00:00:00 2001 From: paul Date: Thu, 20 Jan 2011 06:45:17 +0000 Subject: [PATCH] lcl: don't change TListBox.ItemIndex or set selection based on ItemIndex for MultiSelect listbox on window recreation (bug #0016862) git-svn-id: trunk@29133 - --- lcl/include/customlistbox.inc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lcl/include/customlistbox.inc b/lcl/include/customlistbox.inc index 89a5465644..c4c8a44572 100644 --- a/lcl/include/customlistbox.inc +++ b/lcl/include/customlistbox.inc @@ -32,7 +32,7 @@ type procedure TCustomListBox.AssignCacheToItemData(const AIndex: Integer; const AData: Pointer); begin - if PCustomListBoxItemRecord(AData)^.Selected or (FItemIndex = AIndex) then + if PCustomListBoxItemRecord(AData)^.Selected or (not MultiSelect and (FItemIndex = AIndex)) then begin LockSelectionChange; SendItemSelected(AIndex, True); @@ -103,7 +103,8 @@ begin FItems := NewStrings; FCacheValid := False; - SendItemIndex; + if FItemIndex <> TWSCustomListBoxClass(WidgetSetClass).GetItemIndex(Self) then + SendItemIndex; // copy items attributes cnt := OldItems.Count; @@ -332,7 +333,7 @@ procedure TCustomListBox.SetMultiSelect(Val: Boolean); begin if Val <> FMultiSelect then begin - FMultiSelect:= Val; + FMultiSelect := Val; UpdateSelectionMode; end; end;