mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-21 23:59:26 +02:00
lcl: only call UpdateLookup in TDBLookupComboBox.Loaded if DataLink is active = avoid double initialization of lookup.
Dont update the lookup if destroying code formating git-svn-id: trunk@32501 -
This commit is contained in:
parent
9357e21926
commit
687c14e6a3
@ -26,8 +26,8 @@
|
|||||||
constructor TDBLookupComboBox.Create(AOwner: TComponent);
|
constructor TDBLookupComboBox.Create(AOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
FLookup:= TDBLookup.Create(Self);
|
FLookup := TDBLookup.Create(Self);
|
||||||
FDataLink.OnActiveChange:= @ActiveChange;
|
FDataLink.OnActiveChange := @ActiveChange;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDBLookupComboBox.UpdateData(Sender: TObject);
|
procedure TDBLookupComboBox.UpdateData(Sender: TObject);
|
||||||
@ -59,7 +59,8 @@ end;
|
|||||||
procedure TDBLookupComboBox.Loaded;
|
procedure TDBLookupComboBox.Loaded;
|
||||||
begin
|
begin
|
||||||
inherited Loaded;
|
inherited Loaded;
|
||||||
UpdateLookup;
|
if FDataLink.Active then
|
||||||
|
UpdateLookup;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TDBLookupComboBox.GetKeyField: string;
|
function TDBLookupComboBox.GetKeyField: string;
|
||||||
@ -99,7 +100,7 @@ end;
|
|||||||
|
|
||||||
procedure TDBLookupComboBox.SetKeyField(const Value: string);
|
procedure TDBLookupComboBox.SetKeyField(const Value: string);
|
||||||
begin
|
begin
|
||||||
FLookup.KeyField:= Value;
|
FLookup.KeyField := Value;
|
||||||
UpdateLookup;
|
UpdateLookup;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -113,19 +114,19 @@ end;
|
|||||||
|
|
||||||
procedure TDBLookupComboBox.SetListField(const Value: string);
|
procedure TDBLookupComboBox.SetListField(const Value: string);
|
||||||
begin
|
begin
|
||||||
FLookup.ListField:= Value;
|
FLookup.ListField := Value;
|
||||||
UpdateLookup;
|
UpdateLookup;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDBLookupComboBox.SetListFieldIndex(const Value: Integer);
|
procedure TDBLookupComboBox.SetListFieldIndex(const Value: Integer);
|
||||||
begin
|
begin
|
||||||
FLookup.ListFieldIndex:= Value;
|
FLookup.ListFieldIndex := Value;
|
||||||
UpdateLookup;
|
UpdateLookup;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDBLookupComboBox.SetListSource(const Value: TDataSource);
|
procedure TDBLookupComboBox.SetListSource(const Value: TDataSource);
|
||||||
begin
|
begin
|
||||||
FLookup.ListSource:= Value;
|
FLookup.ListSource := Value;
|
||||||
UpdateLookup;
|
UpdateLookup;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -142,7 +143,7 @@ end;
|
|||||||
|
|
||||||
procedure TDBLookupComboBox.UpdateLookup;
|
procedure TDBLookupComboBox.UpdateLookup;
|
||||||
begin
|
begin
|
||||||
if not (csLoading in ComponentState) then
|
if ([csLoading, csDestroying] * ComponentState) = [] then
|
||||||
begin
|
begin
|
||||||
FLookup.Initialize(FDataLink, Items);
|
FLookup.Initialize(FDataLink, Items);
|
||||||
Text := FLookup.ListFieldValue;
|
Text := FLookup.ListFieldValue;
|
||||||
|
Loading…
Reference in New Issue
Block a user