Last active
March 25, 2018 21:37
-
-
Save Pasquina/3edf6cf751455ab6fc0e2032153685a2 to your computer and use it in GitHub Desktop.
LiveBindings Demo Creating the TListBindSourceAdapter<TBranch> (Alias BranchListBSWrapper)
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
{ When the Adapter Bind Source for Branches is created, this event handler creates the | |
necessry BranchListBSWrapper and passes it back to the Bind Source Adapter. } | |
procedure TMDLBO.absBranchesCreateAdapter( | |
Sender: TObject; | |
var ABindSourceAdapter: TBindSourceAdapter); | |
begin | |
{ Begin by creating the BranchWrapper and saving it in the current form } | |
BranchWrapper := BranchListBSWrapper.Create( // create the Branch Wrapper | |
self, // (a Type Alias for TListBindSourceAdapter<TBranch>) | |
Corp.CorpBranches, // The Wrapper points to TObjectList<TBranch> | |
False); // we keep responsibility for ownership | |
{ Set up the event handlers for the BranchWrapper. This completes the construction of the BranchWrapper } | |
BranchWrapper.AfterScroll := AfterBranchScroll; | |
BranchWrapper.AfterDelete := AfterBranchScroll; | |
BranchWrapper.AfterInsert := AfterBranchScroll; | |
{ Return the BranchWrapper to the AdapterBindSource } | |
ABindSourceAdapter := BranchWrapper; // this gives the TAdapterBindSource the ability to display the branch list | |
end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Shows how the TListBindSourceAdapter is created and linked to the TAdapterBindSource. Also, this example shows the specification of Event Methods needed to synchronize Employee Lists with the currently selected Branch.