mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-10 07:57:12 +01:00
lcl, gtk2: don't force combobox to have 0 ItemIndex - it needs to be -1 if not really assigned (issue #0016354)
git-svn-id: trunk@25060 -
This commit is contained in:
parent
826b437986
commit
4f31973425
@ -44,8 +44,7 @@ begin
|
||||
// and use the interface based list
|
||||
FItems:= NewStrings;
|
||||
|
||||
if FItemIndex <> -1 then
|
||||
TWSCustomComboBoxClass(WidgetSetClass).SetItemIndex(Self, FItemIndex);
|
||||
TWSCustomComboBoxClass(WidgetSetClass).SetItemIndex(Self, FItemIndex);
|
||||
TWSCustomComboBoxClass(WidgetSetClass).SetStyle(Self, FStyle);
|
||||
TWSCustomComboBoxClass(WidgetSetClass).SetArrowKeysTraverseList(Self, FArrowKeysTraverseList);
|
||||
TWSCustomComboBoxClass(WidgetSetClass).SetReadOnly(Self, FReadOnly);
|
||||
|
||||
@ -1044,11 +1044,16 @@ begin
|
||||
|
||||
// this should work but may not in all circumstances
|
||||
Index := -1;
|
||||
if AWithEntry = False then begin // the current widget HAS an entry
|
||||
if AWithEntry = False then
|
||||
begin // the current widget HAS an entry
|
||||
GetText(ACustomComboBox, Text);
|
||||
Index := ACustomComboBox.Items.IndexOf(Text);
|
||||
if Text = '' then
|
||||
Index := -1
|
||||
else
|
||||
Index := ACustomComboBox.Items.IndexOf(Text);
|
||||
end;
|
||||
if Index = -1 then Index := GetItemIndex(ACustomComboBox);
|
||||
if Index = -1 then
|
||||
Index := GetItemIndex(ACustomComboBox);
|
||||
|
||||
if PGtkComboBoxPrivate(PGtkComboBox(ComboWidget)^.priv)^.button <> nil then
|
||||
FreeWidgetInfo(PGtkComboBoxPrivate(PGtkComboBox(ComboWidget)^.priv)^.button);
|
||||
@ -1618,7 +1623,10 @@ begin
|
||||
end
|
||||
else begin
|
||||
// if not an entry it is a readonly list so we will try to comply by matching the text to an item
|
||||
Index := TCustomComboBox(AWinControl).Items.IndexOf(AText);
|
||||
if AText = '' then
|
||||
Index := -1
|
||||
else
|
||||
Index := TCustomComboBox(AWinControl).Items.IndexOf(AText);
|
||||
SetItemIndex(TCustomComboBox(AWinControl), Index);
|
||||
end;
|
||||
Dec(WidgetInfo^.ChangeLock);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user