View Issue Details

IDProjectCategoryView StatusLast Update
0013868LazarusOtherpublic2009-10-23 00:40
ReporteralexP Assigned ToJesus Reyes  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformfpc2.25OSwinxp32 
Fixed in Version0.9.27 (SVN) 
Summary0013868: DBLookupCombobox difficulty in search
Description    
the palette datacontrols the DBLookupCombobox does not leave the datasource and datafield blank it is closed, as in the palette rxaware this feature works fine but the appeal to seek a name from the list when you press a key (example <ho> ... house) this feature exists in both the delphi rxlib as DBLookupCombobox Palette datacontrols, as both have a limitation I can not migrate my applications to Lazarus
Steps To Reproduce    
1 - insert a DBLookupCombobox Palette datacontrols connect the Lookupsource, Lookupfield and Lookupdisplay not connect datasource and datafield and run the application, note that it is closed.
2 - connect datasource datafield and run the application, note that it is open and operating normally press a key example <h> note that it was for the record that begins with h.
    
3 - insert a RXDBLookupCombo Palette rxaward connect the Lookupsource, Lookupfield and Lookupdisplay not connect datasource and datafield and run the application, note that it is open and operating normally press a key example <h> watch it nothing happens.
4 - enter an event onpresskey, note that with the combo it works closed and the open combo does not work
TagsNo tags attached.
Fixed in Revision20925
LazTarget1.0
Widgetset
Attached Files

Activities

jose nepro

2009-05-30 21:45

reporter   ~0028156

this problem actually exists, the two components have this limitation

Jesus Reyes

2009-05-31 01:14

developer   ~0028157

Please reformulate the issue, I cannot understand clearly what is wrong and what needs to be fixed, the summary seems to say something but the description points to another thing. Please do not assume we know how RX controls or delphi controls do work, better to say what (and why) is currently not working and what is the remedy (I'm not asking for a patch [althought that would be great], but the description of things).

If the controls do not behave fine or they do in different way than in Delphi, please create a sample project where you can describe step by step the problem and what do you think needs to be fixed. Please use dbf or firebird (with a backup of database) so we can test here.

Attach the project to this bug report (only source is needed), I expect something like:

1. open the attached project, and run it.
2. datasource is not linked or is closed, it behave this way but it should do this way.
3. click that, it will connect datasource or will activate it, now it behave in this other way but it should do something else.

etc, I hope you got the idea.

alexP

2009-05-31 02:46

reporter   ~0028160

file load

Jesus Reyes

2009-05-31 03:27

developer   ~0028161

I'm sorry, it seems the zip file it's corrupt, I was able to extract lazarus.rar, it includes a binary gdb file, I can't use it, please attach a transportable *backup of database* as requested.

About the Delphi 2006.zip file I can't extract it, but anyway I don't have delphi 2006 so I can't use it, if it includes only a executable file is then Ok to try to attach it again.

alexP

2009-05-31 04:56

reporter   ~0028162

Sorry, I am not aware of this, estrous for the contents of C:\Nova pasta , thereby C:\Nova pasta\TESTE.gdb

    
follows the new Annex I to be asked as

2009-05-31 04:59

 

c_Nova pasta.zip (1,732,428 bytes)

Jesus Reyes

2009-05-31 05:48

developer   ~0028163

Last edited: 2009-05-31 05:49

The zip file seems to be fine this time, but again, I cannot open teste.gdb file, it's for another version of firebird which I don't have, that is why I asked for a transportable backup of database, with such backup I hopefully can recreate the database in my firebird version, btw I use firebird 2.0.

2009-05-31 14:27

 

31 05.fbk (2,048 bytes)

alexP

2009-05-31 14:30

reporter   ~0028173

follows the new annex, I have not worked odd but my Firebird is the version 2.1, verify the path of the database is correctly C:\Nova pasta\TESTE.gdb

Luiz Americo

2009-05-31 22:23

developer   ~0028184

I ran the provided example application and found that changing the Style to csDropDownList got the same behavior as the Delphi application

alexP

2009-06-01 01:39

reporter   ~0028187

correct but the friend who has csDropDownList is the palette datacontrols as active if you do not fill out the fields that datasource and datafield is rxaware the palette, or one has a feature the other has with any other but is equal or I do not search in tables with many records.

Jesus Reyes

2009-06-09 07:09

developer   ~0028381

From the examples a notes here and there it seems this is a bug report for dblookup controls not working when no datasource and no datafield are specified, but when ListSource, ListField and KeyField are specified. It seems dblookup controls should have a mode where it doesn't affect a dataset but only serves for looking up data from another datasource. Please, if this is not right clarify what is this bug report about.

alexP

2009-06-09 13:00

reporter   ~0028390

Now you understand, the palette datacontrols should be activated when there datafield I could not do the research data, in this case is only for research that

Leslie Kaye

2009-06-10 19:11

reporter   ~0028453

Last edited: 2009-07-21 10:48

Jesus. The example works with Firebird 2.1
Hello alexP
I am the author of the lookup controls in Lazarus.
I am not sure that I understand what the problem is.
If you do not wish to change the data you can set the DBLookupCombobox to ReadOnly.
Normally you would set the Style to csDropDownList so that only the lookup values are possible however csDropDown is available in case there are other valid choices for the field value in addition to the look up values.
Why would you want to use a DBLookupCombobox without connecting the DataSource? Could you just use a DBCombobox with its datasource set to the lookup dataset datasource?

jose nepro

2009-06-11 18:20

reporter   ~0028477

you are forgetting that the palette rxnew work with the datasource but not out perform searches in the list which makes the location on tables with many records

alexP

2009-06-21 01:51

reporter   ~0028653

I just make one comment interesting dbloockupcombobox the Palette rxaward in a table with records type 12,15,34 and letters in the same tebela, if you press a number it performs the search, then just solve the problem with missing letters, as role he has

2009-07-21 10:19

 

dblookupnodatafield.patch (17,705 bytes)   
Index: lcl/dbctrls.pp
===================================================================
--- lcl/dbctrls.pp	(revision 20912)
+++ lcl/dbctrls.pp	(working copy)
@@ -136,12 +136,14 @@
     FKeyFieldNames: string;
     FListFieldName: string;
     FListFieldIndex: Integer;
+    FListLinkTmpSetActive: Boolean;
     FLookUpFieldIsCached: Boolean;
     FDataFields: TList;  // Data Fields to lookup/edit
     FKeyFields: TList;   // Keyfields in lookup dataset
     FListField: TField;  // Result field in lookup dataset
     FLookupCache: boolean;
     FLookupList: TLookupList;
+    procedure ActiveChange(Sender: TObject);
     procedure EditingChange(Sender: TObject);
     procedure FetchLookupData;
     function GetKeyFieldName: string;
@@ -151,6 +153,9 @@
     procedure SetKeyFieldName(const Value: string);
     procedure SetListSource(Value: TDataSource);
     procedure SetLookupCache(const Value: boolean);
+  protected
+    procedure Notification(AComponent: TComponent;
+      Operation: TOperation); override;
   public
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
@@ -345,11 +350,6 @@
     property DataField: string read GetDataField write SetDataField;
     property DataSource: TDataSource read GetDataSource write SetDataSource;
 
-    // we need to overrride the write method for db aware.
-    // the Read isn't an issue since the list will be updated
-    // on data change anyway
-    property Items write SetItems;
-
     //same as dbedit need to match the datalink status
     property ReadOnly: Boolean read GetReadOnly write SetReadOnly default False;
   end;
@@ -370,7 +370,10 @@
     property DragMode;
     property ExtendedSelect;
     property ItemHeight;
-    property Items;
+    // we need to overrride the write method for db aware.
+    // the Read isn't an issue since the list will be updated
+    // on data change anyway
+    property Items write SetItems;
     property MultiSelect;
     property OnClick;
     property OnDblClick;
@@ -419,9 +422,7 @@
     procedure SetLookupCache(const Value: boolean);
   protected
     procedure DataChange(Sender: TObject); override;
-    procedure FinalizeWnd; override;
     procedure InitializeWnd; override;
-    procedure Loaded; override;
     procedure UpdateData(Sender: TObject); override;
   public
     constructor Create(AOwner: TComponent); override;
@@ -726,11 +727,8 @@
     procedure SetListFieldIndex(const Value: Integer);
     procedure SetListSource(const Value: TDataSource);
     procedure SetLookupCache(const Value: boolean);
-    procedure UpdateLookup;
   protected
-    procedure FinalizeWnd; override;
     procedure InitializeWnd; override;
-    procedure Loaded; override;
     procedure UpdateData(Sender: TObject); override;
     procedure UpdateText; override;
   public
Index: lcl/include/customdbcombobox.inc
===================================================================
--- lcl/include/customdbcombobox.inc	(revision 20912)
+++ lcl/include/customdbcombobox.inc	(working copy)
@@ -43,12 +43,15 @@
   //need to override this to make sure the datalink gets notified
   //its been modified, then when post etc, it will call
   //updatedata to update the field data with current value
-  if FDatalink.Edit then
-  begin
-    FDataLink.Modified;
+  if FDatalink.Active then
+    if FDatalink.Edit then
+    begin
+      FDataLink.Modified;
+      inherited Change;
+    end else
+      UpdateText
+  else
     inherited Change;
-  end else
-    UpdateText;
 end;
 
 
Index: lcl/include/dblookup.inc
===================================================================
--- lcl/include/dblookup.inc	(revision 20912)
+++ lcl/include/dblookup.inc	(working copy)
@@ -70,8 +70,10 @@
   FListLink:= TFieldDataLink.Create;
   FListLink.DataSource := TDataSource.Create(Self);
   FListLink.Control := Self;
+  FListLink.OnActiveChange := @ActiveChange;
   FListLink.OnEditingChange:=@EditingChange;
   FHasLookUpField:= False;
+  FListLinkTmpSetActive := False;
   FLookupCache := False;
 end;
 
@@ -84,6 +86,14 @@
   inherited Destroy;
 end;
 
+procedure TDBLookup.ActiveChange(Sender: TObject);
+begin
+  if (csDestroying in ComponentState) then
+    Exit;
+  if FListLink.Active and not FListLinkTmpSetActive then
+    Initialize(FControlLink, FControlItems);
+end;
+
 procedure TDBLookup.EditingChange(Sender: TObject);
 begin
   if not (FListLink.Editing) then
@@ -114,7 +124,13 @@
 
 procedure TDBLookup.SetListSource(Value: TDataSource);
 begin
+  if FListSource = Value then
+    Exit;
+  if Assigned(FListSource) then
+    FListSource.RemoveFreeNotification(Self);
   FListSource:= Value;
+  if Assigned(FListSource) then
+    FListSource.FreeNotification(Self);
 end;
 
 procedure TDBLookup.SetLookupCache(const Value: boolean);
@@ -124,14 +140,34 @@
     FLookupList := TLookupList.Create;
 end;
 
+procedure TDBLookup.Notification(AComponent: TComponent; Operation: TOperation);
+begin
+  inherited Notification(AComponent, Operation);
+  if (Operation=opRemove) then
+    if (AComponent = FListSource) then
+      FListSource:= nil;
+end;
+
 procedure TDBLookup.LinkGetBookMark;
 begin
-  FLinkBookMark := FListLink.DataSet.GetBookmark;
-  FListLink.DataSet.DisableControls;
+  FListLinkTmpSetActive := not FListLink.DataSet.Active;
+  if FListLinkTmpSetActive then
+    FListLink.DataSet.Active := True
+  else
+  begin
+    FLinkBookMark := FListLink.DataSet.GetBookmark;
+    FListLink.DataSet.DisableControls;
+  end;
 end;
 
 procedure TDBLookup.LinkGotoBookMark;
 begin
+  if FListLinkTmpSetActive then
+  begin
+    FListLink.DataSet.Active := False;
+    FListLinkTmpSetActive := False;
+  end
+  else
   try
     FListLink.DataSet.GotoBookmark(FLinkBookMark);
     FListLink.DataSet.FreeBookmark(FLinkBookMark);
@@ -141,19 +177,13 @@
 end;
 
 procedure TDBLookup.FetchLookupData;
-var
-  TmpActive: Boolean;
 begin
   if not Assigned(FControlItems) then
     Exit;
   FControlItems.Clear;
   if not (Assigned(FListLink.DataSet) and Assigned(FListField)) then
     Exit;
-  TmpActive := FListLink.DataSet.Active;
-  if TmpActive then
-    LinkGetBookMark
-  else
-    FListLink.DataSet.Active := True;
+  LinkGetBookMark;
   try
     if FLookupCache then
       FLookupList.Clear;
@@ -167,79 +197,93 @@
       FListLink.DataSet.Next;
     end;
   finally
-    if TmpActive then
-      LinkGotoBookMark
-    else
-      FListLink.DataSet.Active := False;
+    LinkGotoBookMark;
   end;
 end;
 
 procedure TDBLookup.Initialize(AControlDataLink: TFieldDataLink; AControlItems: TStrings);
 var
   ListFields: TList;
-  TmpActive: Boolean;
   S: string;
 begin
   FDataFields.Clear;
   FKeyFields.Clear;
   FListField := nil;
-  if not (Assigned(AControlDataLink) and Assigned(AControlItems)) then
-    Exit; // Closing or our DataLink is Active but not the Control's DataLink
-  FControlLink:= AControlDataLink;
-  FControlItems:= AControlItems;
-  if not Assigned(AControlDataLink.Field) then
-  // should be but (sometimes) not (bug?)
+  FHasLookUpField := False;
+  FLookUpFieldIsCached := False;
+  FControlItems := AControlItems;
+  FControlLink := AControlDataLink;
+  if Assigned(FControlLink) and Assigned(FControlLink.DataSet)
+    and FControlLink.DataSet.Active then
   begin
-    S:= AControlDataLink.FieldName;
-    AControlDataLink.FieldName:= '';
-    AControlDataLink.FieldName:= S;
+    if not Assigned(FControlLink.Field) then
+    // should be but (sometimes) not (bug?)
+    begin
+      S:= FControlLink.FieldName;
+      FControlLink.FieldName:= '';
+      FControlLink.FieldName:= S;
+    end;
+    if Assigned(FControlLink.Field) then
+    begin
+      FHasLookUpField := (FControlLink.Field.FieldKind = fkLookup);
+      FLookUpFieldIsCached := (FHasLookupField and FControlLink.Field.LookupCache);
+      if FHasLookUpField then
+      begin
+        if (FListLink.DataSource.DataSet <> FControlLink.Field.LookupDataSet) then
+          FListLink.DataSource.DataSet:= FControlLink.Field.LookupDataSet;
+        FDataFieldNames := FControlLink.Field.KeyFields;
+        FKeyFieldNames := FControlLink.Field.LookupKeyFields;
+      end else
+        FDataFieldNames := FControlLink.Field.FieldName;
+      FControlLink.DataSet.GetFieldList(FDataFields, FDataFieldNames);
+    end;
   end;
-  if not Assigned(AControlDataLink.Field) then
-    Exit;
-  FHasLookUpField := (AControlDataLink.Field.FieldKind = fkLookup);
-  FLookUpFieldIsCached := (FHasLookupField and AControlDataLink.Field.LookupCache);
-  if FHasLookUpField then
-  begin
-    FListLink.DataSource.DataSet:= AControlDataLink.Field.LookupDataSet;
-    FDataFieldNames := AControlDataLink.Field.KeyFields;
-    FKeyFieldNames := AControlDataLink.Field.LookupKeyFields;
-  end
-  else
-  if FListSource<>nil then begin
-    FListLink.DataSource.DataSet := FListSource.DataSet;
-    FDataFieldNames := AControlDataLink.Field.FieldName;
-  end else
-    FListLink.Datasource.DataSet := nil;
+  if not FHasLookUpField then
+    if Assigned(FListSource) then
+    begin
+      if (FListLink.DataSource.DataSet <> FListSource.DataSet) then
+        FListLink.DataSource.DataSet := FListSource.DataSet;
+    end
+    else
+      FListLink.Datasource.DataSet := nil;
 
-  if (FKeyFieldNames <> '') and (FListLink.Dataset<>nil) then
+  if (FKeyFieldNames > '') and Assigned(FListLink.Dataset) then
   begin
     ListFields := TList.Create;
-    TmpActive := FListLink.DataSet.Active;
+    FListLinkTmpSetActive := not FListLink.DataSet.Active;
     try
-      AControlDataLink.DataSet.GetFieldList(FDataFields, FDataFieldNames);
-      FListLink.DataSet.Active := True;
-      FListLink.DataSet.GetFieldList(ListFields, FListFieldName);
-      FListLink.DataSet.GetFieldList(FKeyFields, FKeyFieldNames);
-      if FHasLookUpField then
+      if FListLinkTmpSetActive then
+        FListLink.DataSet.Open;
+      if FListLink.DataSet.Active then
       begin
-        FListField := FListLink.DataSet.FindField(AControlDataLink.Field.LookupResultField);
-        if (Assigned(FListField) and (ListFields.IndexOf(FListField) < 0)) then
-          ListFields.Insert(0, FListField);
-        if (ListFields.Count > 0) then
-          FListField := TField(ListFields[0]);
-      end else
-      begin
-        if ((FKeyFields.Count > 0) and (ListFields.Count = 0)) then
-          ListFields.Add(FKeyFields[0]);
-        if ((FListFieldIndex >= 0) and (FListFieldIndex < ListFields.Count)) then
-          FListField := TField(ListFields[FListFieldIndex]) else
-          FListField := TField(ListFields[0]);
+        FListLink.DataSet.GetFieldList(ListFields, FListFieldName);
+        FListLink.DataSet.GetFieldList(FKeyFields, FKeyFieldNames);
+        if FHasLookUpField then
+        begin
+          FListField := FListLink.DataSet.FindField(AControlDataLink.Field.LookupResultField);
+          if (Assigned(FListField) and (ListFields.IndexOf(FListField) < 0)) then
+            ListFields.Insert(0, FListField);
+          if (ListFields.Count > 0) then
+            FListField := TField(ListFields[0]);
+        end else
+        begin
+          if ((FKeyFields.Count > 0) and (ListFields.Count = 0)) then
+            ListFields.Add(FKeyFields[0]);
+          if ((FListFieldIndex > -1) and (FListFieldIndex < ListFields.Count)) then
+            FListField := TField(ListFields[FListFieldIndex])
+          else
+            FListField := TField(ListFields[0]);
+        end;
+        if Assigned(FListField) then
+          FListLink.FieldName:= FListField.FieldName;
       end;
-      if Assigned(FListField) then
-        FListLink.FieldName:= FListField.FieldName;
     finally
       ListFields.Free;
-      FListLink.DataSet.Active := TmpActive;
+      if FListLinkTmpSetActive then
+      begin
+        FListLink.DataSet.Active := False;
+        FListLinkTmpSetActive := False;
+      end;
     end;
     FetchLookupData;
   end;
@@ -248,7 +292,6 @@
 function TDBLookup.ListFieldValue: string;
 var
   Key: Variant;
-  TmpActive: Boolean;
 begin
   Result := '';
   if not ((Assigned(FControlLink) and assigned(FListField) and FControlLink.Active)) then
@@ -267,21 +310,14 @@
     Result := FLookupList.ValueOfKey(Key);
     Exit;
   end;
-  TmpActive := FListLink.DataSet.Active;
-  if TmpActive then
-    LinkGetBookMark
-  else
-    FListLink.DataSet.Active := True;
+  LinkGetBookMark;
   try
     if FListLink.DataSet.Locate(FKeyFieldNames,
       FControlLink.DataSet.FieldValues[FDataFieldNames], []) then
       Result := FListField.AsString
     else Result:= '';
   finally
-    if TmpActive then
-      LinkGotoBookMark
-    else
-      FListLink.DataSet.Active := False;
+    LinkGotoBookMark;
   end;
 end;
 
@@ -292,7 +328,6 @@
 {$ELSE}
 var
   I: Integer;
-  TmpActive: Boolean;
   Key: Variant;
 begin
   if AListFieldValue = FControlLink.Field.AsString then
@@ -312,11 +347,7 @@
   end;
   if not (Assigned(FListLink.DataSet) and Assigned(FListField)) then
     Exit;
-  TmpActive := FListLink.DataSet.Active;
-  if TmpActive then
-    LinkGetBookMark
-  else
-    FListLink.DataSet.Active := True;
+  LinkGetBookMark;
   try
     if FListLink.DataSet.Locate(FListField.FieldName, VarArrayOf([AListFieldValue]), []) then
     begin
@@ -327,10 +358,7 @@
         FControlLink.Field.AsString := AListFieldValue;
     end;
   finally
-    if TmpActive then
-      LinkGotoBookMark
-    else
-      FListLink.DataSet.Active := False;
+    LinkGotoBookMark;
   end;
 end;
 {$ENDIF}
Index: lcl/include/dblookupcombobox.inc
===================================================================
--- lcl/include/dblookupcombobox.inc	(revision 20912)
+++ lcl/include/dblookupcombobox.inc	(working copy)
@@ -30,12 +30,6 @@
   FDataLink.OnActiveChange:= @ActiveChange;
 end;
 
-procedure TDBLookupComboBox.Loaded;
-begin
-  inherited Loaded;
-  UpdateLookup;
-end;
-
 procedure TDBLookupComboBox.UpdateData(Sender: TObject);
 begin
   FLookup.UpdateData(Text);
@@ -43,10 +37,10 @@
 
 procedure TDBLookupComboBox.ActiveChange(Sender: TObject);
 begin
-  if FDataLink.Active then
-    FLookup.Initialize(FDataLink, Items)
-  else FLookup.Initialize(nil, nil);
-  inherited;
+  if (csLoading in ComponentState) then
+    Exit;
+  FLookup.Initialize(FDataLink, Items);
+  UpdateText;
 end;
 
 procedure TDBLookupComboBox.UpdateText;
@@ -54,6 +48,12 @@
   Text:= FLookup.ListFieldValue;
 end;
 
+procedure TDBLookupComboBox.InitializeWnd;
+begin
+  inherited InitializeWnd;
+  ActiveChange(Self);
+end;
+
 function TDBLookupComboBox.GetKeyField: string;
 begin
   Result := FLookup.KeyField;
@@ -82,46 +82,31 @@
 procedure TDBLookupComboBox.SetKeyField(const Value: string);
 begin
   FLookup.KeyField:= Value;
-  UpdateLookup;
+  ActiveChange(Self);
 end;
 
 procedure TDBLookupComboBox.SetListField(const Value: string);
 begin
   FLookup.ListField:= Value;
-  UpdateLookup;
+  ActiveChange(Self);
 end;
 
 procedure TDBLookupComboBox.SetListFieldIndex(const Value: Integer);
 begin
   FLookup.ListFieldIndex:= Value;
+  ActiveChange(Self);
 end;
 
 procedure TDBLookupComboBox.SetListSource(const Value: TDataSource);
 begin
   FLookup.ListSource:= Value;
-  UpdateLookup;
+  ActiveChange(Self);
 end;
 
 procedure TDBLookupComboBox.SetLookupCache(const Value: boolean);
 begin
   FLookup.LookupCache := Value;
+  ActiveChange(Self);
 end;
 
-procedure TDBLookupComboBox.UpdateLookup;
-begin
-  if FDataLink.Active then
-    ActiveChange(Self);
-end;
 
-procedure TDBLookupComboBox.FinalizeWnd;
-begin
-  inherited FinalizeWnd;
-  FLookup.FControlItems := Items;
-end;
-
-procedure TDBLookupComboBox.InitializeWnd;
-begin
-  inherited InitializeWnd;
-  FLookup.FControlItems := Items;
-end;
-
Index: lcl/include/dblookuplistbox.inc
===================================================================
--- lcl/include/dblookuplistbox.inc	(revision 20912)
+++ lcl/include/dblookuplistbox.inc	(working copy)
@@ -29,14 +29,6 @@
   FDataLink.OnActiveChange:= @ActiveChange;
 end;
 
-
-procedure TDBLookupListBox.Loaded;
-begin
-  inherited Loaded;
-  if FDataLink.Active then
-    ActiveChange(Self);
-end;
-
 procedure TDBLookupListBox.UpdateData(Sender: TObject);
 begin
   if (ItemIndex < 0) then
@@ -46,12 +38,10 @@
 
 procedure TDBLookupListBox.ActiveChange(Sender: TObject);
 begin
-  if FDataLink.Active then
-  begin
-    FLookup.Initialize(FDataLink, Items);
-    DataChange(Self);
-  end
-  else FLookup.Initialize(nil,nil);
+  if (csLoading in ComponentState) then
+    Exit;
+  FLookup.Initialize(FDataLink, Items);
+  DataChange(Self);
 end;
 
 procedure TDBLookupListBox.DataChange(Sender: TObject);
@@ -59,16 +49,10 @@
   ItemIndex:= Items.IndexOf(FLookup.ListFieldValue);
 end;
 
-procedure TDBLookupListBox.FinalizeWnd;
-begin
-  inherited FinalizeWnd;
-  FLookup.FControlItems := Items;
-end;
-
 procedure TDBLookupListBox.InitializeWnd;
 begin
   inherited InitializeWnd;
-  FLookup.FControlItems := Items;
+  ActiveChange(Self);
 end;
 
 function TDBLookupListBox.GetKeyField: string;
@@ -99,25 +83,30 @@
 procedure TDBLookupListBox.SetKeyField(const Value: string);
 begin
   FLookup.KeyField:= Value;
+  ActiveChange(Self);
 end;
 
 procedure TDBLookupListBox.SetListField(const Value: string);
 begin
   FLookup.ListField:= Value;
+  ActiveChange(Self);
 end;
 
 procedure TDBLookupListBox.SetListFieldIndex(const Value: Integer);
 begin
   FLookup.ListFieldIndex:= Value;
+  ActiveChange(Self);
 end;
 
 procedure TDBLookupListBox.SetListSource(const Value: TDataSource);
 begin
   FLookup.ListSource:= Value;
+  ActiveChange(Self);
 end;
 
 procedure TDBLookupListBox.SetLookupCache(const Value: boolean);
 begin
   FLookup.LookupCache := Value;
+  ActiveChange(Self);
 end;
 
dblookupnodatafield.patch (17,705 bytes)   

Leslie Kaye

2009-07-21 10:43

reporter   ~0029195

Last edited: 2009-07-21 10:48

I attach a patch which
1) Enables the lookup control Items to be filled with lookup data independant of whether the DataField is assigned or not.
2) Adds to DBComboBox Change to call inherited where there is no DataField. This activates key press search and will fill the Text property when an Item is selected.
3} A couple of bug fixes.

Behaviour after this patch
If there is no datafield then the DBComboBox and the derived DBLookupComboBox act like an ordinary ComboBoxes.
For the DBLookupComboBox and DBLookupListBox the Items prefilled from a lookup dataset

Jesus Reyes

2009-07-22 22:18

developer   ~0029211

Thanks, patch applied with one additional check in TDBLookup.ListFieldValue.
I think this issue is now resolved and can be closed by reporter if he agree.

Issue History

Date Modified Username Field Change
2009-05-30 19:20 alexP New Issue
2009-05-30 21:45 jose nepro Note Added: 0028156
2009-05-30 23:16 Jesus Reyes Status new => assigned
2009-05-30 23:16 Jesus Reyes Assigned To => Jesus Reyes
2009-05-31 01:14 Jesus Reyes LazTarget => 1.0
2009-05-31 01:14 Jesus Reyes Note Added: 0028157
2009-05-31 01:14 Jesus Reyes Status assigned => feedback
2009-05-31 02:46 alexP File Added: sample.zip
2009-05-31 02:46 alexP Note Added: 0028160
2009-05-31 03:27 Jesus Reyes Note Added: 0028161
2009-05-31 04:56 alexP Note Added: 0028162
2009-05-31 04:59 alexP File Added: c_Nova pasta.zip
2009-05-31 05:44 Jesus Reyes File Deleted: sample.zip
2009-05-31 05:48 Jesus Reyes Note Added: 0028163
2009-05-31 05:49 Jesus Reyes Note Edited: 0028163
2009-05-31 14:27 alexP File Added: 31 05.fbk
2009-05-31 14:30 alexP Note Added: 0028173
2009-05-31 22:23 Luiz Americo Note Added: 0028184
2009-06-01 01:39 alexP Note Added: 0028187
2009-06-09 07:09 Jesus Reyes Note Added: 0028381
2009-06-09 13:00 alexP Note Added: 0028390
2009-06-10 19:11 Leslie Kaye Note Added: 0028453
2009-06-11 18:20 jose nepro Note Added: 0028477
2009-06-21 01:51 alexP Note Added: 0028653
2009-07-21 10:19 Leslie Kaye File Added: dblookupnodatafield.patch
2009-07-21 10:43 Leslie Kaye Note Added: 0029195
2009-07-21 10:48 Leslie Kaye Note Edited: 0029195
2009-07-21 10:48 Leslie Kaye Note Edited: 0028453
2009-07-22 22:18 Jesus Reyes Fixed in Revision => 20925
2009-07-22 22:18 Jesus Reyes Status feedback => resolved
2009-07-22 22:18 Jesus Reyes Fixed in Version => 0.9.27 (SVN)
2009-07-22 22:18 Jesus Reyes Resolution open => fixed
2009-07-22 22:18 Jesus Reyes Note Added: 0029211
2009-10-23 00:40 Marc Weustink Status resolved => closed