From 687c14e6a39fde90651910183d553d3674057c16 Mon Sep 17 00:00:00 2001 From: blikblum Date: Sat, 24 Sep 2011 14:02:42 +0000 Subject: [PATCH] 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 - --- lcl/include/dblookupcombobox.inc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lcl/include/dblookupcombobox.inc b/lcl/include/dblookupcombobox.inc index d92a9ab641..19dcd863a1 100644 --- a/lcl/include/dblookupcombobox.inc +++ b/lcl/include/dblookupcombobox.inc @@ -26,8 +26,8 @@ constructor TDBLookupComboBox.Create(AOwner: TComponent); begin inherited Create(AOwner); - FLookup:= TDBLookup.Create(Self); - FDataLink.OnActiveChange:= @ActiveChange; + FLookup := TDBLookup.Create(Self); + FDataLink.OnActiveChange := @ActiveChange; end; procedure TDBLookupComboBox.UpdateData(Sender: TObject); @@ -59,7 +59,8 @@ end; procedure TDBLookupComboBox.Loaded; begin inherited Loaded; - UpdateLookup; + if FDataLink.Active then + UpdateLookup; end; function TDBLookupComboBox.GetKeyField: string; @@ -99,7 +100,7 @@ end; procedure TDBLookupComboBox.SetKeyField(const Value: string); begin - FLookup.KeyField:= Value; + FLookup.KeyField := Value; UpdateLookup; end; @@ -113,19 +114,19 @@ end; procedure TDBLookupComboBox.SetListField(const Value: string); begin - FLookup.ListField:= Value; + FLookup.ListField := Value; UpdateLookup; end; procedure TDBLookupComboBox.SetListFieldIndex(const Value: Integer); begin - FLookup.ListFieldIndex:= Value; + FLookup.ListFieldIndex := Value; UpdateLookup; end; procedure TDBLookupComboBox.SetListSource(const Value: TDataSource); begin - FLookup.ListSource:= Value; + FLookup.ListSource := Value; UpdateLookup; end; @@ -142,7 +143,7 @@ end; procedure TDBLookupComboBox.UpdateLookup; begin - if not (csLoading in ComponentState) then + if ([csLoading, csDestroying] * ComponentState) = [] then begin FLookup.Initialize(FDataLink, Items); Text := FLookup.ListFieldValue;