LCL: DbLookupCombobox: do not initialize lookup on datachange.

git-svn-id: trunk@58967 -
This commit is contained in:
jesus 2018-09-12 18:03:34 +00:00
parent e4164ae839
commit 721c734e03
2 changed files with 13 additions and 7 deletions

View File

@ -860,6 +860,7 @@ Type
procedure SetLookupCache(const Value: boolean);
procedure SetNullValueKey(const AValue: TShortCut);
procedure UpdateLookup;
procedure UpdateItemIndex;
protected
procedure InitializeWnd; override;
procedure DestroyWnd; override;

View File

@ -63,7 +63,7 @@ end;
procedure TDBLookupComboBox.DataChange(Sender: TObject);
begin
UpdateLookup;
UpdateItemIndex;
end;
procedure TDBLookupComboBox.DoOnSelect;
@ -187,16 +187,21 @@ begin
end;
procedure TDBLookupComboBox.UpdateLookup;
var
i: Integer;
begin
if ([csLoading, csDestroying] * ComponentState) = [] then
begin
FLookup.Initialize(FDataLink, Items);
i := FLookup.GetKeyIndex;
ItemIndex := i;
if i = -1 then
Text := '';
UpdateItemIndex;
end;
end;
procedure TDBLookupComboBox.UpdateItemIndex;
var
i: Integer;
begin
i := FLookup.GetKeyIndex;
ItemIndex := i;
if i = -1 then
Text := '';
end;