Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do you fill a TIWDBLookupList with ListSource data?
#1
ListSource | ListField data not showing in TIWDBLookupList.  How do you get the data to show?
Reply
#2
You will need to be more specific. Generally it mimics the standard DBCombos, but you need to make sure it has an active data source etc.
Reply
#3
(03-20-2018, 10:14 PM)cogniscaena Wrote: ListSource | ListField data not showing in TIWDBLookupList.  How do you get the data to show?

It basically works just like a std VCL TDBLookupListBox. 
Connect a TDataSource to it through its ListSource property. Set KeyField and ListField properties. You are done.
It will display all records in your TDataSource. To use this TIWDBLookupList to update another dataset you must connect it to a second TDataSource through its DataSource property. Also set its DataField property.

DataSource's DataField will be updated using KeyField value of ListSource
Reply
#4
"It basically works just like a std VCL TDBLookupListBox. "

Not entirely.

There seems to be a difference with the VCL component, and that is that the cursor does not change while clicking an object in the list.
For example, this code always returns the result of the last record. In VCL this code gives me the value of column1 for the line that is clicked on. 

procedure TIWForm1.IWDBLookupListBox1AsyncClick(Sender: TObject;  EventParams: TStringList);
begin
iwedit1.Text:=clientdataset1.FieldByName('Column1').asString ;
end;
Reply
#5
SOLVED! By adding this line in the asyncclick method:

clientdataset1.RecNo:= iwdblookuplistbox1.ItemIndex;
Reply
#6
(01-12-2021, 11:58 AM)KristofVR Wrote: "It basically works just like a std VCL TDBLookupListBox. "

Not entirely.

There seems to be a difference with the VCL component, and that is that the cursor does not change while clicking an object in the list.
For example, this code always returns the result of the last record. In VCL this code gives me the value of column1 for the line that is clicked on. 

procedure TIWForm1.IWDBLookupListBox1AsyncClick(Sender: TObject;  EventParams: TStringList);
begin
iwedit1.Text:=clientdataset1.FieldByName('Column1').asString ;
end;


That's now how you should do it.

VCL and Web applications *are* different and behave differently too.

You need to inspect the value of the IWDBLookupListBox, not the value of the lookup ClientDataSet.

Try to do

IwEdit1.Text := IWDBLookupListBox1.SelectedValue;  // or SelectedText
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)