0

We are porting a D6 application to XE3.

In D6 I inherited a complex code which used shared datasets and datasources everywhere.

This worked well in D6.

After we could run the XE3 version, we experienced that lookup combo boxes changed.

On dropdown they reset the other dropdown's keyvalues (everywhere in the program)!

If two dropdowns use on dataset, and if I click on the first to down it, and select, on down the second keyvalue changed to NULL; and reverse - if I click on the second, the first's keyvalue change to NULL...

This is global in this program, so I need to find fast solution.

May somebody have any information about this "bug" (or "feature"? :-) ), or have a solution in his/her hand?

Thanks for any answer!

Danilo Casa
  • 506
  • 1
  • 9
  • 18
durumdara
  • 3,411
  • 4
  • 43
  • 71

2 Answers2

0

This is intentional. Take a look at the implemention of TCustomDBLookupComboBox.ListLinkDataChanged; in Vcl.DBCtrls. You will find the comment:

  { Fix for Defect# 204311, Non-bound control should clear when list datasource changes }
bummi
  • 27,123
  • 14
  • 62
  • 101
0

Solution: put your datasets on a data module. Instantiate that for every form, so every form works with a separate instance of the dataset. Make sure you set the name of the data module to an empty string after instantiation, or the Delphi streaming system will still use the first correctly named instance when hooking up the form's datasources with the datasets.

When the data module(s) are in the form's uses clause (interface or implementation doesn't matter) the IDE will still offer you their components through the Object Inspector.

You will want to put the database connection on a different data module that you only instantiate once (possibly automatically).

Marjan Venema
  • 19,136
  • 6
  • 65
  • 79