Author: Jim T1392
The adapter components TListBindSourceAdapter and TObjectBindSourceAdapter enable LiveBindings with user defined TObjects.
Here is a user defined TObject for example.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
<span style="color:red;"><strong>type</strong></span><br> TContact <span style="color:blue;font-size:xx-small;">=</span> <span style="color:red;"><strong>class</strong></span><br> <span style="color:red;"><strong>private</strong></span><br> FFirstName<span style="color:blue;font-size:xx-small;"><strong>:</strong></span> <span style="color:red;"><strong>string</strong></span><span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> FLastName<span style="color:blue;font-size:xx-small;"><strong>:</strong></span> <span style="color:red;"><strong>string</strong></span><span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>public</strong></span><br> <span style="color:red;"><strong>constructor</strong></span> Create<span style="color:blue;font-size:xx-small;"><strong>;</strong></span> overload<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>constructor</strong></span> Create<span style="color:blue;font-size:xx-small;"><strong>(</strong></span><span style="color:red;"><strong>const</strong></span> AFirstName<span style="color:blue;font-size:xx-small;"><strong>,</strong></span> ALastName<span style="color:blue;font-size:xx-small;"><strong>:</strong></span> <span style="color:red;"><strong>string</strong></span><span style="color:blue;font-size:xx-small;"><strong>)</strong></span><span style="color:blue;font-size:xx-small;"><strong>;</strong></span> overload<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> FirstName<span style="color:blue;font-size:xx-small;"><strong>:</strong></span> <span style="color:red;"><strong>string</strong></span> read FFirstName write FFirstName<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> LastName<span style="color:blue;font-size:xx-small;"><strong>:</strong></span> <span style="color:red;"><strong>string</strong></span> read FLastName write FLastName<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>end</strong></span><span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <br> <span style="color:red;"><strong>function</strong></span> LoadContacts<span style="color:blue;font-size:xx-small;"><strong>:</strong></span> TList<span style="color:blue;font-size:xx-small;"><</span>TContact<span style="color:blue;font-size:xx-small;">></span><span style="color:blue;font-size:xx-small;"><strong>;</strong></span> |
1 2 3 4 5 6 7 8 9 10 |
<span style="color:red;"><strong>implementation</strong></span><br> <br> <span style="color:red;"><strong>function</strong></span> LoadContacts<span style="color:blue;font-size:xx-small;"><strong>:</strong></span> TList<span style="color:blue;font-size:xx-small;"><</span>TContact<span style="color:blue;font-size:xx-small;">></span><span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>begin</strong></span><br> Result <span style="color:blue;font-size:xx-small;"><strong>:</strong></span><span style="color:blue;font-size:xx-small;">=</span> TObjectList<span style="color:blue;font-size:xx-small;"><</span>TContact<span style="color:blue;font-size:xx-small;">></span><span style="color:blue;font-size:xx-small;"><strong><span style="color:blue;font-size:xx-small;"><strong>.</strong></span></strong></span>Create<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:green;"><em>// TODO: Load data from file<br> </em></span> Result<span style="color:blue;font-size:xx-small;"><strong><span style="color:blue;font-size:xx-small;"><strong>.</strong></span></strong></span>Add<span style="color:blue;font-size:xx-small;"><strong>(</strong></span>TContact<span style="color:blue;font-size:xx-small;"><strong><span style="color:blue;font-size:xx-small;"><strong>.</strong></span></strong></span>Create<span style="color:blue;font-size:xx-small;"><strong>(</strong></span><span style="color:purple;">'Adam'</span><span style="color:blue;font-size:xx-small;"><strong>,</strong></span> <span style="color:purple;">'Barns'</span><span style="color:blue;font-size:xx-small;"><strong>)</strong></span><span style="color:blue;font-size:xx-small;"><strong>)</strong></span><span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> Result<span style="color:blue;font-size:xx-small;"><strong><span style="color:blue;font-size:xx-small;"><strong>.</strong></span></strong></span>Add<span style="color:blue;font-size:xx-small;"><strong>(</strong></span>TContact<span style="color:blue;font-size:xx-small;"><strong><span style="color:blue;font-size:xx-small;"><strong>.</strong></span></strong></span>Create<span style="color:blue;font-size:xx-small;"><strong>(</strong></span><span style="color:purple;">'Chris'</span><span style="color:blue;font-size:xx-small;"><strong>,</strong></span> <span style="color:purple;">'Decker'</span><span style="color:blue;font-size:xx-small;"><strong>)</strong></span><span style="color:blue;font-size:xx-small;"><strong>)</strong></span><span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> Result<span style="color:blue;font-size:xx-small;"><strong><span style="color:blue;font-size:xx-small;"><strong>.</strong></span></strong></span>Add<span style="color:blue;font-size:xx-small;"><strong>(</strong></span>TContact<span style="color:blue;font-size:xx-small;"><strong><span style="color:blue;font-size:xx-small;"><strong>.</strong></span></strong></span>Create<span style="color:blue;font-size:xx-small;"><strong>(</strong></span><span style="color:purple;">'Emma'</span><span style="color:blue;font-size:xx-small;"><strong>,</strong></span> <span style="color:purple;">'Fisk'</span><span style="color:blue;font-size:xx-small;"><strong>)</strong></span><span style="color:blue;font-size:xx-small;"><strong>)</strong></span><span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>end</strong></span><span style="color:blue;font-size:xx-small;"><strong>;</strong></span> |
One way to use TListBindSourceAdapter is to instantiate the adapter at run time. Drop a TAdapterBindSourceAdapter on the form and implement the CreateAdapter event as follows:
1 2 3 4 5 6 7 8 9 10 11 12 |
<span style="color:red;"><strong>mplementation</strong></span><br> <br> <span style="color:green;"><em>{$R *.dfm}</em></span><br> <br> <span style="color:red;"><strong>uses</strong></span> ContactsUnit<span style="color:blue;font-size:xx-small;"><strong>,</strong></span> System<span style="color:blue;font-size:xx-small;"><strong><span style="color:blue;font-size:xx-small;"><strong>.</strong></span></strong></span>Generics<span style="color:blue;font-size:xx-small;"><strong><span style="color:blue;font-size:xx-small;"><strong>.</strong></span></strong></span>Collections<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <br> <span style="color:red;"><strong>procedure</strong></span> TForm1<span style="color:blue;font-size:xx-small;"><strong><span style="color:blue;font-size:xx-small;"><strong>.</strong></span></strong></span>AdapterBindSource1CreateAdapter<span style="color:blue;font-size:xx-small;"><strong>(</strong></span>Sender<span style="color:blue;font-size:xx-small;"><strong>:</strong></span> TObject<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>var</strong></span> ABindSourceAdapter<span style="color:blue;font-size:xx-small;"><strong>:</strong></span> TBindSourceAdapter<span style="color:blue;font-size:xx-small;"><strong>)</strong></span><span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>begin</strong></span><br> ABindSourceAdapter <span style="color:blue;font-size:xx-small;"><strong>:</strong></span><span style="color:blue;font-size:xx-small;">=</span> TListBindSourceAdapter<span style="color:blue;font-size:xx-small;"><</span>TContact<span style="color:blue;font-size:xx-small;">></span><span style="color:blue;font-size:xx-small;"><strong><span style="color:blue;font-size:xx-small;"><strong>.</strong></span></strong></span>Create<span style="color:blue;font-size:xx-small;"><strong>(</strong></span>Self<span style="color:blue;font-size:xx-small;"><strong>,</strong></span><br> LoadContacts<span style="color:blue;font-size:xx-small;"><strong>)</strong></span><span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>end</strong></span><span style="color:blue;font-size:xx-small;"><strong>;</strong></span><span style="font-weight:bold;color:red;">i</span> |
In the LiveBindings designer, we won’t see the fields for TContact because the TContact type is not known at design time.
Drop a TStringGrid on the form and connection the ‘*’ of AdapterBindSource1 to StringGrid1.
A navigator can be added by right clicking AdapterBindSource1 and choosing “Add Navigator”.
The grid is populated when the application is run:
A TDataGeneratorAdapter can be used to provide some fields to use at design time. Add fields with the same name as the properties in TContact. Set AdapterBindSource1.Adapter to DataGeneratorAdapter1.
The form shows sample data and the LiveBindings designer shows field names.
To show this data at design time, the TDataGeneratorAdapter fields have FieldType: ftString and Generator: LoremIpsum.
The LiveBindings designer can be used to connect fields to controls.
Note that an easy way to create a TLabeledEdit is to right click on FirstName then choose “Link to new control…”.
At runtime, the TListBindSourceAdapter will be used instead of DataGeneratorAdapter1 because of the CreateAdapter event.
Another way to use TListBindSourceAdapter is to register a custom component. Instead of instantiating a TListBindSourceAdapter in the CreateAdapter event, the custom component is dropped from the tool palette. A TDataGeneratorAdapter is not needed.
The minimal code to for a custom adapter looks like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
<span style="color:red;"><strong>unit</strong></span> ContactsAdapter<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <br> <span style="color:red;"><strong>interface</strong></span><br> <br> <span style="color:red;"><strong>uses</strong></span> ContactsUnit<span style="color:blue;font-size:xx-small;"><strong>,</strong></span> Data<span style="color:blue;font-size:xx-small;"><strong><span style="color:blue;font-size:xx-small;"><strong>.</strong></span></strong></span>Bind<span style="color:blue;font-size:xx-small;"><strong><span style="color:blue;font-size:xx-small;"><strong>.</strong></span></strong></span>ObjectScope<span style="color:blue;font-size:xx-small;"><strong>,</strong></span> System<span style="color:blue;font-size:xx-small;"><strong><span style="color:blue;font-size:xx-small;"><strong>.</strong></span></strong></span>Classes<span style="color:blue;font-size:xx-small;"><strong>,</strong></span> System<span style="color:blue;font-size:xx-small;"><strong><span style="color:blue;font-size:xx-small;"><strong>.</strong></span></strong></span>Generics<span style="color:blue;font-size:xx-small;"><strong><span style="color:blue;font-size:xx-small;"><strong>.</strong></span></strong></span>Collections<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <br> <span style="color:red;"><strong>type</strong></span><br> <br> TContactsAdapter <span style="color:blue;font-size:xx-small;">=</span> <span style="color:red;"><strong>class</strong></span><span style="color:blue;font-size:xx-small;"><strong>(</strong></span>TListBindSourceAdapter<span style="color:blue;font-size:xx-small;"><</span>TContact<span style="color:blue;font-size:xx-small;">></span><span style="color:blue;font-size:xx-small;"><strong>)</strong></span><br> <span style="color:red;"><strong>public</strong></span><br> <span style="color:red;"><strong>constructor</strong></span> Create<span style="color:blue;font-size:xx-small;"><strong>(</strong></span>AOwner<span style="color:blue;font-size:xx-small;"><strong>:</strong></span> TComponent<span style="color:blue;font-size:xx-small;"><strong>)</strong></span><span style="color:blue;font-size:xx-small;"><strong>;</strong></span> <span style="color:red;"><strong>override</strong></span><span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>end</strong></span><span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <br> <span style="color:red;"><strong>implementation</strong></span><br> <br> <span style="color:green;"><em>{ TContactsAdapter }</em></span><br> <br> <span style="color:red;"><strong>constructor</strong></span> TContactsAdapter<span style="color:blue;font-size:xx-small;"><strong><span style="color:blue;font-size:xx-small;"><strong>.</strong></span></strong></span>Create<span style="color:blue;font-size:xx-small;"><strong>(</strong></span>AOwner<span style="color:blue;font-size:xx-small;"><strong>:</strong></span> TComponent<span style="color:blue;font-size:xx-small;"><strong>)</strong></span><span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>begin</strong></span><br> <span style="color:red;"><strong>inherited</strong></span> Create<span style="color:blue;font-size:xx-small;"><strong>(</strong></span>AOwner<span style="color:blue;font-size:xx-small;"><strong>)</strong></span><span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> SetList<span style="color:blue;font-size:xx-small;"><strong>(</strong></span>LoadContacts<span style="color:blue;font-size:xx-small;"><strong>)</strong></span><span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>end</strong></span><span style="color:blue;font-size:xx-small;"><strong>;</strong></span> |
To register the custom adapter, you will need to create and register a package which contains the custom adapter component and TContact class. You will also need and a Register method to register the custom component.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<span style="color:red;"><strong>unit</strong></span> ContactsAdapterReg<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <br> <span style="color:red;"><strong>interface</strong></span><br> <br> <span style="color:red;"><strong>procedure</strong></span> Register<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <br> <span style="color:red;"><strong>implementation</strong></span><br> <br> <span style="color:red;"><strong>uses</strong></span> System<span style="color:blue;font-size:xx-small;"><strong><span style="color:blue;font-size:xx-small;"><strong>.</strong></span></strong></span>Classes<span style="color:blue;font-size:xx-small;"><strong>,</strong></span> ContactsAdapter<span style="color:blue;font-size:xx-small;"><strong>,</strong></span> ContactsAdapter2<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <br> <span style="color:red;"><strong>procedure</strong></span> Register<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>begin</strong></span><br> RegisterComponents<span style="color:blue;font-size:xx-small;"><strong>(</strong></span><span style="color:purple;">'Test'</span><span style="color:blue;font-size:xx-small;"><strong>,</strong></span> <span style="color:blue;font-size:xx-small;"><strong>[</strong></span>TContactsAdapter<span style="color: blue;font-size: xx-small"><strong>]</strong></span><span style="color:blue;font-size:xx-small;"><strong>)</strong></span><span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>end</strong></span><span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <br> <span style="color:red;"><strong>end</strong></span><span style="color:blue;font-size:xx-small;"><strong><span style="color:blue;font-size:xx-small;"><strong>.</strong></span></strong></span> |
A complete implementation of a custom adapter publishes properties and methods:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
TContactsAdapter2 <span style="color:blue;font-size:xx-small;">=</span> <span style="color:red;"><strong>class</strong></span><span style="color:blue;font-size:xx-small;"><strong>(</strong></span>TListBindSourceAdapter<span style="color:blue;font-size:xx-small;"><</span>TContact<span style="color:blue;font-size:xx-small;">></span><span style="color:blue;font-size:xx-small;"><strong>)</strong></span><br> <span style="color:red;"><strong>public</strong></span><br> <span style="color:red;"><strong>constructor</strong></span> Create<span style="color:blue;font-size:xx-small;"><strong>(</strong></span>AOwner<span style="color:blue;font-size:xx-small;"><strong>:</strong></span> TComponent<span style="color:blue;font-size:xx-small;"><strong>)</strong></span><span style="color:blue;font-size:xx-small;"><strong>;</strong></span> <span style="color:red;"><strong>override</strong></span><span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> published<br> <span style="color:red;"><strong>property</strong></span> OnBeforeSetList<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> OnAfterSetList<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> OnListAppend<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> OnListDelete<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> OnListInsert<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> OnCreateItemInstance<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> OnInitItemInstance<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> Options<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> AutoEdit<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> BeforeOpen<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> AfterOpen<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> BeforeClose<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> AfterClose<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> BeforeInsert<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> AfterInsert<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> BeforeEdit<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> AfterEdit<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> BeforePost<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> AfterPost<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> BeforeCancel<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> AfterCancel<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> BeforeDelete<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> AfterDelete<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> BeforeScroll<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> AfterScroll<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> BeforeRefresh<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> AfterRefresh<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> BeforeApplyUpdates<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> AfterApplyUpdates<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> BeforeCancelUpdates<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> AfterCancelUpdates<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> OnDeleteError<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> OnInsertError<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> OnEditError<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> OnPostError<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> OnApplyUpdatesError<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> OnCancelUpdatesError<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> OnApplyUpdates<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> OnCancelUpdates<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>property</strong></span> OnHasUpdates<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>end</strong></span><span style="color:blue;font-size:xx-small;"><strong>;</strong></span> |
TObjectBindSourceAdapter is used instead of TListBindSourceAdapter to bind to a single object, rather than a list of objects.
TObjectBindSourceAdapter is instantiated like this:
1 2 3 4 5 6 |
<span style="color:red;"><strong>procedure</strong></span> TForm1<span style="color:blue;font-size:xx-small;"><strong><span style="color:blue;font-size:xx-small;"><strong>.</strong></span></strong></span>AdapterBindSource1CreateAdapter<span style="color:blue;font-size:xx-small;"><strong>(</strong></span>Sender<span style="color:blue;font-size:xx-small;"><strong>:</strong></span> TObject<span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>var</strong></span> ABindSourceAdapter<span style="color:blue;font-size:xx-small;"><strong>:</strong></span> TBindSourceAdapter<span style="color:blue;font-size:xx-small;"><strong>)</strong></span><span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>begin</strong></span><br> ABindSourceAdapter <span style="color:blue;font-size:xx-small;"><strong>:</strong></span><span style="color:blue;font-size:xx-small;">=</span> TObjectBindSourceAdapter<span style="color:blue;font-size:xx-small;"><</span>TContact<span style="color:blue;font-size:xx-small;">></span><span style="color:blue;font-size:xx-small;"><strong><span style="color:blue;font-size:xx-small;"><strong>.</strong></span></strong></span>Create<span style="color:blue;font-size:xx-small;"><strong>(</strong></span>Self<span style="color:blue;font-size:xx-small;"><strong>,</strong></span><br> TContact<span style="color:blue;font-size:xx-small;"><strong><span style="color:blue;font-size:xx-small;"><strong>.</strong></span></strong></span>Create<span style="color:blue;font-size:xx-small;"><strong>(</strong></span><span style="color:purple;">'Adam'</span><span style="color:blue;font-size:xx-small;"><strong>,</strong></span> <span style="color:purple;">'Barns'</span><span style="color:blue;font-size:xx-small;"><strong>)</strong></span><span style="color:blue;font-size:xx-small;"><strong>)</strong></span><span style="color:blue;font-size:xx-small;"><strong>;</strong></span><br> <span style="color:red;"><strong>end</strong></span><span style="color:blue;font-size:xx-small;"><strong>;</strong></span> |
At run time, there is only a single row of data.
Source forge samples
https://radstudiodemos.svn.sourceforge.net/svnroot/radstudiodemos/branches/RadStudio_XE3/LiveBindings/observers
- ContactsAdapterPackage.dpk
- Implements a custom TListBindSourceAdapter component
- ListAdapterEventProject.dpr
- Demonstrates TAdapterBindSource.CreateAdapter event
- ListAdapterComponentProject.dpr
- Demonstrates custom TListBindSourceAdapter component
- Project: CppListAdapterEventProject.dpr
- Cpp project demonstrates TAdapterBindSource.CreateAdapter event
Design. Code. Compile. Deploy.
Start Free Trial Upgrade Today
Free Delphi Community Edition Free C++Builder Community Edition