By: Sarina DuPont
Abstract: Blog post from Sarina DuPont
This is a copy of a blog post. Click the title below to link to the original blog post and see any related comments or updates.
If you buy Delphi, C++Builder or RAD Studio XE5 Pro or higher between December 9 and December 31, 2013, you get a download for the InfoPower XE5 VCL Grid and Components. The InfoPower XE5 VCL Grid is a fast, efficient and flexible grid for use in your VCL applications.
I thought I would do a quick tutorial to show how easy it is to use the grid with FireDAC and the LiveBindings Wizard and VCL Styles.
In the IDE, go Tools->FireDAC Explorer. The first thing we need to do is define a new Connection by clicking on the Document icon. In this case, I also right-clicked to rename the connection to EMPLOYEE, but that is not necessary.
For our Database, we are going to select the sample ‘employee’ InterBase database that ships with XE5.
Then we need to enter the default username and password.
In the IDE, we are going to right-click on our form and select ‘LiveBindings Wizard’.
Select ‘Create a Data Source’, click Next and then select FireDAC as the Class Name.
Next, we are going to define our data source properties and test the connection and click Finish.
In order to connect my Employee data with my InfoPower VCL Grid, I am going to drop the TwwDBGrid component onto my form and resize it. Next I am going to drop the TDataSource component onto my form and set the DataSet to FDTableEmployee. Select the grid component, and set the DataSource to DataSource1.
The grid will now get populated with our InterBase sample data.
In addition to connecting our grid to data, we can also use the LiveBindings Designer (View->LiveBindings Designer) to visually bind our employee datasource to additional components, such as TEdit or TMemo. In this case, I am going to right-click on one of the BindSourceEmployee members in the LiveBindings Designer, i.e. FIRST_Name, and select ‘Link to new Control -> TLabeledEdit’.
Instead of using the right-click menu in the LiveBindings Designer, you can also just drop a TLabel or TEdit onto your form and select the Caption or Text property in the LiveBindings Designer for the respective component and you will see any bindable member highlighted in green. You can then just click and drag to bind the two components.
Here is what my sample application looks like.
The last step is to apply a style to my application via Project->Options->Application->Appearance. Select one of the Custom Styles and make sure it is also selected as the Default Style in the drop-down menu.
The selected style is shown at runtime. You will also notice that the data in the labeled Edit controls is kept in sync with the record in the grid.
Don’t forget to take advantage of our current promotions before December 31st to get the InfoPower XE5 VCL Grid and Components for RAD Studio XE5. In addition, the current offer also includes the "Coding in Delphi" book by Nick Hodges, InfoPower Grid for FireMonkey and additional powerful tools to boost your coding. Plus, existing customers can upgrade to XE5 from any earlier version of Delphi, C++Builder or RAD Studio and get up to 45% off.
To learn more, visit http://www.embarcadero.com/radoffer
Posted by sarinadupont on December 19th, 2013
Download Delphi XE5 now!
Get Free Trial
Webinars on demand!
More social media choices:
Delphi on Google+
@RADTools on Twitter
Server Response from: ETNASC03