3

I can't find a way to bind a TCombobox with a lookup field in Firemonkey. In VCL you have a TDBLookupComboBox that just needs a TDatasource component and the lookup field name to populate the combobox list. In this way you can edit the FK field easly at runtime.

In Firemonkey all you have is Livebindings and I can't figure out how to set up the same behavior. The best i've done so far is to populate the combobox list with a TBindList and use a TBindDBListLink connected to the lookup field. In this way it seems to work but the combobox doesn't let me change the selected item.

This is one of the most basic things that a database application should have but i don't get why there is no one talking about it yet.

RRUZ
  • 134,889
  • 20
  • 356
  • 483
Xenon
  • 179
  • 2
  • 14

1 Answers1

0

You can download Delphi XE2 LiveBinding Demos from this SVN address:

https://radstudiodemos.svn.sourceforge.net/svnroot/radstudiodemos/branches/RadStudio_XE2/LiveBindings

Once you download it, you can find a demo project called bindlookup. It demonstrates how to have lookup lists using LiveBinding.

vcldeveloper
  • 7,399
  • 2
  • 33
  • 39
  • Hi vcldeveloper, thanks for your time. **bindlookup** demo doesn't do exactly what I'm trying to do because the binding is done between the selected item in a populated Listbox and the current record of a TClientDataset. Following your suggestion I figure out how to change it to bind the selected item index in my combobox with the Foreign Key ID of my TClientDataset. The magic is done by the TBindPosition binding. It seems to work now but I have to put the TClientDataset in edit/insert mode manually (Combobox OnChange event?) I miss the old TDBLookupCombobox :°) – Xenon Sep 19 '11 at 10:28
  • The link is dead. (the site is not available through the wayback machine) – Zoe May 25 '19 at 16:15