mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-07-07 07:45:55 +02:00
TComboBox: update ItemIndex in RealSetText also if Text is empty string. Issue #39366.
This commit is contained in:
parent
70452d48d7
commit
a669e08450
@ -450,14 +450,13 @@ var
|
|||||||
I: integer;
|
I: integer;
|
||||||
begin
|
begin
|
||||||
// when items have same text, FItems.IndexOf(AValue) gives wrong index. Issue #28683.
|
// when items have same text, FItems.IndexOf(AValue) gives wrong index. Issue #28683.
|
||||||
if AValue<>'' then
|
// Items can contain an empty string, set ItemIndex in that case too. Issue #39366
|
||||||
begin
|
|
||||||
I := ItemIndex;
|
I := ItemIndex;
|
||||||
if (I < 0) or (I >= FItems.Count) or (FItems[I] <> AValue) then
|
if (I < 0) or (I >= FItems.Count) or (FItems[I] <> AValue) then
|
||||||
if not (csLoading in ComponentState) then
|
if not (csLoading in ComponentState) then
|
||||||
ItemIndex := FItems.IndexOf(AValue);
|
ItemIndex := FItems.IndexOf(AValue);
|
||||||
|
if AValue<>'' then
|
||||||
HideEmulatedTextHint;
|
HideEmulatedTextHint;
|
||||||
end;
|
|
||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user