Skip to content

Instantly share code, notes, and snippets.

@Pasquina
Created March 25, 2018 19:59
Show Gist options
  • Save Pasquina/6f81371656756e4c14b15cd26697839d to your computer and use it in GitHub Desktop.
Save Pasquina/6f81371656756e4c14b15cd26697839d to your computer and use it in GitHub Desktop.
LiveBindings Demo Creating the TObjectBindSourceAdapter<TCorp> (Alias CorpObjectBSWrapper)
{ When the Adapter Bind Source for the Corp is created, this event handler creates the
necessary CorpBSWrapper and passes it back to the Bind Source Adapter }
procedure TMDLBO.absCorpCreateAdapter(
Sender: TObject;
var ABindSourceAdapter: TBindSourceAdapter);
begin
{ Begin by creating the CorpWrapper and saving it in the current form }
CorpWrapper := CorpObjectBSWrapper.Create( // create the Corp Wrapper
self, // (a Type Alias for TObjectBindSourceAdapter<TCorp>)
Corp, // The Wrapper points to TCorp
False); // we keep responsibility for ownership
{ Return the CorpWrapper to the AdapterBindSource }
ABindSourceAdapter := CorpWrapper; // this gives the TAdapterBindSource the ability to display the Corp object
end;
@Pasquina
Copy link
Author

Shows how the TObjectBindSourceAdapter is created and linked to the TAdapterBindSource.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment