From a4f6996c218654a2240612865611baa32d5f025e Mon Sep 17 00:00:00 2001 From: micha Date: Mon, 28 Nov 2005 21:43:09 +0000 Subject: [PATCH] prevent setting itemindex -1 git-svn-id: trunk@8234 - --- lcl/include/customcombobox.inc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lcl/include/customcombobox.inc b/lcl/include/customcombobox.inc index 232a12adda..31ad25de09 100644 --- a/lcl/include/customcombobox.inc +++ b/lcl/include/customcombobox.inc @@ -842,6 +842,7 @@ end; procedure TCustomComboBox.UpdateSorted; var lText: string; + lIndex: integer; begin if HandleAllocated then TWSCustomComboBoxClass(WidgetSetClass).Sort(Self, Items, FSorted) @@ -850,7 +851,9 @@ begin // remember text lText := Text; TStringList(FItems).Sorted := FSorted; - ItemIndex := FItems.IndexOf(lText); + lIndex := FItems.IndexOf(lText); + if lIndex >= 0 then + ItemIndex := lIndex; end; end;