Jim T1392 Tierney

Jim T1392 has not set their biography yet

Posted by on in Blogs
In the previous post, TListBindSourceAdapter<TContact> is used to enable a list of Delphi TContact objects with LiveBindings, using the CreateAdapter event handler: implementation {$R *.dfm} uses ContactsUnit, System.Generics.Collections; procedure TForm1.AdapterBindSource1CreateAdapter(Sender: TObject; var ABindSourceAdapter: TBindSourceAdapter); begin ABindSourceAdapter := TListBindSourceAdapter<TContact>.Create(Self, LoadContacts); end; C++ custom object can also be enabled for LiveBindings.   Here is a C++ version of TContact for example: #pragma explicit_rtti methods (__published, public) properties (__published, public) fields(__published, public) ...

Posted by on in Blogs
The adapter components TListBindSourceAdapter and TObjectBindSourceAdapter enable LiveBindings with user defined TObjects. Here is a user defined TObject  for example. type TContact = class private FFirstName: string; FLastName: string; public constructor Create; overload; constructor Create(const AFirstName, ALastName: string); overload; property FirstName: string read FFirstName write FFirstName; property LastName: string read FLastName write FLastName; end; function LoadContacts: TList<TContact>; implementation function LoadContacts: TList<TContact>; begin Result := TObjectList<TContact>.Create; // TODO: Load ...

Posted by on in Blogs
Here is a summary of the samples which accompany my XE3 VLB posts.  The samples are grouped by Sourceforge locations. Observers (post) VclSampleObservableControls.dpk - Implements an observable TTrackBar LinkTrackbarToField.dpr - TObservableTrackBar project Actions (post) Navigate using actions and TSpeedButton Vcl\LiveBindingsActionsProtoProject.dpr Fmx\FmxLiveBindingsActionsProtoProject.dpr Vcl\LiveBindingsActionCDSProject.dpr Fmx\FmxLiveBindingsActionsCDSProject.dpr ListControls (post1, post2) ListBoxVCL.dpr - Link a TListBox to a field SimpleListView.dpr - Link a TListView to a field LiveViewColumns.dpr - Link a TListView to a field and fil...

Posted by on in Blogs
A previous post uses TListBox to demonstrate how to link fields to a list control.  The same steps can be used to link fields to TListView. Here is a sample form with a TListView: To improve the TListView appearance, the ListView1.ViewStyle property has been set to vsList. The LiveBindings designer looks like this: A project containing this form can be downloaded here.  See SimpleListView.dpr. The LiveBindings designer also supports TListView columns.  Follow these steps to add columns to ListView1: Select ListView1 View the object inspector Use the object inspector to change properties of ListView1 Change ListView1.ViewStyle to vsReport Click on the "......

Posted by on in Blogs
A lookup control displays a value that is different from the actual field value. In this post, I modify the sample application built in the previous post about lookup lists. The lookup list example ended with this design: The lookup list ended with this form: To demonstrate a lookup control, this form is changed so that the TLabeledEdit displays a color name instead of a color number. For example, "DarkGreen" is displayed instead of "25600". To accomplish this, a "LookupDataSource" is configured in the object inspector. First, show the LiveBindings designer by selecting the "View/LiveBindings designer" command. Click the line connecting LabeledEditColor1.Text an...
A lookup list is used when the actual data values are not meaningful to users. A lookup list populates a list control with display values, instead of actual data values. We can configure two TPrototypeBindSource components to represent a situation that calls for a lookup list. These steps differ from the previous post by using a Colors field in addition to a ColorsName field. The Colors field holds a numeric color value. First, create the "DataSource". New VCL application Drop a TPrototypeBindSource on the form In the object inspector, set PrototypeBindSource1.RecordCount to 10 Add a Colors field to the TPrototypeBindSource Next, create the "FillDataSource" Drop a second...
List controls can be linked to data source fields. TListBox, TComboBox and VCL TListView are examples of list controls. When a list control is linked to a data source field, the selected item in the list control corresponds to the value of the data source field. To change the value of the field, the user selects a different item in the list control. Typically, two data sources are used with a list control. One data source provides the value to select in the list control. The other data source provides the values to fill the list control. LiveBindings uses the terms "DataSource" and "FillDataSource". The TPrototypeBindSource is a simple way to create data sources. We can confi...

Posted by on in Blogs
This post describes how to specify which components show on the LiveBindings designer. Hide/Show Component Classes To reduce clutter, the LiveBindings designer hides many classes of components. The default settings show most visual control classes and hide most non-visual components classes except for data sources. The settings are in Tools/Options/LiveBindings: If there is a component class that you always want to see on the LiveBindings designer, add it to the "Included Items:" field. For example, if you use FireMonkey 3D controls then you'll probably want to add "TControl3D". This setting will cause components derived from TControl3D, like TText3D, to show in the L...

Posted by on in Blogs
LiveBindings actions are new in XE3.  If you are not familiar with actions, follow this link.  LiveBindings actions correspond to the buttons on the TBindNavigator such as First, Next, Edit, Post, and Delete. Steps for creating a speed button which uses a LiveBindings action: Drop a  TPrototypeBindSource on the form and add fields.  See this post. Drop a  TActionList Drop a TSpeedButton In the object inspector, click the down arrow next to the SpeedButton1.Action property. Choose "New Standard Action/LiveBindings/TBindNavigateNext" Set the BindNavigateNext1.DataSource property to PrototypeBindSource1. Here is a FireMonkey form using LiveBindings actions: VCL: ...
Simple controls can be linked to component properties.   TEdit is an example of a simple control.  TLabel.Text is an example of a component property.   Controls can be linked to most public properties of any component on a form. Link controls to component properties in the LiveBindings designer After a TEdit and TLabel are dropped on a FireMonkey form, the LiveBindings designer represents the TEdit with the member "Text" and the TLabel with the member "Text": The LiveBindings designer can be used to connect these members: In the form you will notice that the value of the label has been copied to the edit.  When the link is initialized, the component property value is copied t...