Created
March 25, 2018 19:44
-
-
Save Pasquina/31771a7e65b3404d6f4ffac6d3fbba89 to your computer and use it in GitHub Desktop.
LiveBindings Demo Data Module Constructor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ The overridden constructor for the data module first creates the data objects that are | |
displayed by the view. This is done by creating the TCorp object which will cascade | |
through the TBranch and TEmployee objects to create the entire data tree. It is important | |
that the data objects be created BEFORE the data module (this form's) objects because the | |
OnCreate event for the TAdapterBindSource objects will need the data objects to function | |
properly. This is accomplished by creating TCorp FIRST, and then calling the inherited Create. | |
The inherited Create will actually create the objects in this TDataModule. } | |
constructor TMDLBO.Create(AOwner: TComponent); | |
begin | |
Corp := TCorp.Create( // Important: Create the data objects before anything else | |
'Acme Distributors', // these are | |
'5237 N Ravenswood Ave', // arbitrary values | |
'Chicago', // displayed by | |
'IL', // the view | |
'United States', // in the | |
'+1 312 555-5555'); // top banner | |
inherited; // now create the objects on this data module | |
end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Demonstrates how to ensure that the data objects are created before the actual DataModule objects are instantiated.