Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: LookupCombobox component under Firemonkey



Permlink Replies: 0
Stéphane WIERZB...

Posts: 58
Registered: 9/3/00
LookupCombobox component under Firemonkey
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 23, 2015 12:03 PM
Hello,

How can I manage this ? :

I have a dataset with ID and Description fields.
I need the records to be displayed in a comboBox. Description need to be displayed (in the listbox and with the selected element).
ID should be associated with the available items.

I'm able to display these records on a comboBox (using livebindings) but I can't find a way to get the ID value.

Here is how I've set my visual binding :
[BINDSOURCEDB].ID ----> [COMBOBOX].Item.LookupData
[BINDSOURCEDB].Description ----> [COMBOBOX].Item.Text

Here is my code (OnButonClick)

if Assigned(ComboBox1.Selected) then
Begin
if MyDataset.Locate('Description',ComboBox1.Selected.Text,[]) then
label1.Text = MyDataset.FieldByName('ID').AsString;
End;

How can I get .Item.LookupData ?
I'm right now doing a locate on my dataset ! This is cumbersome, isn't there another way to get my ID ?

Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02