AV error w/lookup combo on detail grid in Master/Detail config
Using FirePower 12.0.5.5...
I have 2 grids, a master and detail. Each have lookup combos for drop down options on a column.
In the master grid, every works fine. When I try to change a value in the detail grid, it's an AV error upon selecting a new value.
The AV error...
The stack...
The setup...
-
Official comment
Kyle, I don't think I have enough info to reproduce. Can you email us at support a simple project with the problem? Also can you try dropping in a TwwLookupComboEdit and attaching this a a custom control instead of using the properties. I recall seeing a case where the auto-created lookup combo will not work but the custom control does.
Comment actions -
I will try using a separate TwwLookupComboEdit tomorrow.
Here is a test project and I think the DDL for all the tables.
-
I figured out the source of the problem. A LookupCombo column in a master/detail relation where the detail grid is in an expander causes the AV error. Dropping a lookup combo and assigning a custom control to the column, as you suggested, works. One condition: The lookup key field must be in the drop down and must be the first column. When the user starts typing, it matches on the key field, not the result field. Not the preferred behavior.
None of this is needed in the master grid. LookupCombo's work as expected and desired.
In a related matter, why does the master record disappear when the detail is expanded?
ACORUS expanded:
-
Are you using the latest. There was a recent change relating to master/detail that might address your display issue when expanded.
Version 12.0.5.6 (3/1/2020) - Requires RAD Studio 10.3.2 or 10.3.3
-
TwwDataGrid - Master Detail Grid could have painting problems in some cases with PaintOptions.PaintEfficiency set to BufferRecords. This problem is fixed.
-
-
Installed 12.05.6, verified PaintEfficiency set to BufferRecords, and performed a Build. The master record still disappears when child is expanded.
Any reason why they LookupField must be the first column in the drop down grid in detail grids? No LookupField column or custom control needed in master grid.
Note: In the sample app I provided, unit3 has an expander setup. Delete it and children to remove the AV error. The other test form, unit1 has an extra expander that can be deleted.
-
I see one problem in your project in that you have wwexpander1 doing nothing and having an embedded grid attached to the same bind source. I believe this is causing the access violation since it is invisible. Can you delete wwexpander1 since it seems to be of no use in your project.
-
Yea. I was experimenting and left some kruft. See my note above about Unit3. There was an unattached expander in unit1 I believe. I cleared all of that out and am still seeing errors:
1. AV error when using LookupCombo on details.
2. Master record disappears when child grid expanded.
Probably obvious, but the purpose of Unit1 & Unit3 is the ease of switching to either form for testing by auto-creating and setting the main form.
Here's my Unit1 now:
Unit3 cleaned up:
-
Clarification on the disappearing master record issue. It's just the first record in the dataset that disappears. Expand the 10th record in master to see child grid, recno 1 disappears.
Please download the sample project again. It's cleaned up and includes a backup of the SQL database. Restore to Express or Server.
Good to know on the AV error. It's really the last show stopper. The separate master/detail grid, as seen in unit 3, is working. It was failing because of the leftover child expander & grid. Even those not used in unit 3, setting the combo value in the detail grid tripped the expander grid and created an AV.
-
I have created a test FirePower build addressing all your issues. Can you please try at
https://drive.google.com/file/d/1OhHAODZJNiO853Fn419EK7GGYY2oQ_8G/view?usp=sharing
Please let me know your results.
-
1. FIXED: AV error in child grid when selecting value in a LookupCombo.
2. FIXED: First record in master grid disappearing when child grid expanded.
3. FIXED: Invalid cast when adding item to a LookupCombo in a TwwRecordViewPanel.
A big thank you for getting this addressed quickly!
Please sign in to leave a comment.
Comments
19 comments