Please read LiveBindings in VCL – Part 4 – Master Detail before reading this blog / watching the video
In the last blog we looked at how to use master detail and how the BeforeScroll and AfterScoll events worked. I also created using Generics a Sync Object that allowed a single detail object to be linked to.
As promised, this blog post takes it a step further, using the previous foundation I have updated the code (so make sure you download the latest version from code central from the link below) to allow multiple objects of different types to be linked. Additionally, detail lists are also now available.
Link to code sample below…
Sample is downloadable from Code Central
The sample code in this project and the advanced live binding helper class is available for use from code central.
http://cc.embarcadero.com/item/30448
Happy Coding.
EDIT: Updated code on 27th November 2015 due to a memory leak that is now solved.
Very nice example. But you shoud subtitle it with “How to get a bunch of memleaks”.
With ReportMemoryLeaksOnShutdown := True; you will get:
—————————
Unexpected Memory Leak
—————————
An unexpected memory leak has occurred. The unexpected small block leaks are:
1 – 12 bytes: TPropertyValueWriter x 2, TPropertyValueReader x 1, TPropertyValueWriter x 5, TPropertyValueReader x 12, TPropertyValueReader x 10, TPropertyValueWriter x 2, TPropertyValueReader x 2, TPropertyValueWriter x 5, TPropertyValueReader x 8, TFee x 3, TFoo2 x 15, Unknown x 1
13 – 20 bytes: TVLBSyncDetailObjectLink x 1, TVLBSyncMasterList x 1, TVLBSyncDetailListLink x 1, TVLBSyncDetailObjectLink x 1, TVLBSyncDetailObjectLink x 1, TVLBSyncDetailObjectLink x 1, TFud x 12, UnicodeString x 4
21 – 28 bytes: TBindSourceAdapterGetMemberObject x 1, TFoo x 3, UnicodeString x 32, Unknown x 1
29 – 36 bytes: TBindSourceAdapterReadField x 1, TBindSourceAdapterReadField x 7, TBindSourceAdapterReadField x 3, TBindSourceAdapterReadObjectField x 8, UnicodeString x 21
37 – 44 bytes: TForm2.Create$0$ActRec x 1, UnicodeString x 10
45 – 52 bytes: TBindSourceAdapterReadWriteObjectField x 2, TBindSourceAdapterReadWriteField x 5, TBindSourceAdapterReadWriteField x 2, TBindSourceAdapterReadWriteField x 5, TList x 1, UnicodeString x 2
53 – 60 bytes: TObjectList x 1, TObjectList x 1, TObjectList x 3, TObjectList x 1, Unknown x 4
69 – 76 bytes: UnicodeString x 6
85 – 92 bytes: UnicodeString x 12
101 – 108 bytes: UnicodeString x 12
317 – 348 bytes: Unknown x 1
381 – 412 bytes: TObjectBindSourceAdapter x 1
—————————
OK
—————————
This is now fixed in the uploaded sample.
Perfect