FirePower || TwwRecordViewPanel using the FireMonkey Library
Normally your applications will need to edit a record in the database and you will have to create a form to do this, with edit controls and labels.
For instance, if you create your own record view with only Embarcadero’s components, you have to manually create each text box and change the width, height, location, size, etc. The first time may not be that big of an issue as even though it would be time intensive, at least you have your layout and template done for the future.
However, if you ever need to make a change or take out a field because the end-user does not want it or for whatever reason, you would then have to manually change the spacing or order of each field to make sure it looks even and pleasing to the eye.
The TwwRecordViewPanel allows you to easily customize the interface, change the structure and layout with just a few clicks, and add or remove fields without messing up the entirety of the record view. No more adjusting every field when you have to make a change. Simply add or delete a field and our TwwRecordView does the rest.
Our TwwRecordView is simple in setting up and with our free trial of FirePower (click here if you’d like to download our trial version) or official product, you can add this to your application in minutes.
Making our DataBase
Refer to our other blogpost “Using a FirePower LookupCombo in a Datagrid” and follow the first step: "Setting up the grid to use the Orders table in our database" For this purpose, we will only need one table and will be using fdCustomers.
Connecting our RecordView to the Database
Add our TwwRecordViewPanel to the application and then simply connect the DataSource to our bsCustomer. You should now see something similar to this: (I’ll add a picture later).
Making Changes to the record view structure and outline
Double-click the record view and another window will appear. In this window, add the fields you would like, in my instance, I will add all fields.
You should now see the fields you selected in your RecordView.
We will add three headers: Name, Address, and Miscellaneous.
I will move Name right above Company Name. I will move Address, right above City, and Miscellaneous above Buyer. We now have headers in our record view to help with organization. I can then add and remove fields and rearrange the order to how my end user would want. The TwwRecordViewPanel will then automatically readjust the spacing.
Run the program and let’s take a look!
Adding CustomControls
If you wanted to change some of the control types such as changing our "Buyer" field to have a checkbox rather than a simple "yes" or "no," we can change that quickly. There are other options to choose from, but for this example, we will connect a checkbox to the Buyer field.
Double-Click the record view and select "buyer"
Under the Object Inspector, click on ControlAttributes, Checkbox, and make sure that ValueChecked is "Yes" and ValueUnchecked is "no"
Now select ControlType and click on gdctCheckBox
This now changes the Buyer Field to have a checkbox instead of a simple Yes or No.
We hope you are able to incorporate this into your own application and that this helps