By: Tim DelChiaro
Abstract: This tutorial demonstrates how to use FireMonkey layouts to create a simple calculator interface
This tutorial is part of the RAD Studio XE3 online documentation. Links in the article go to the Embarcadero Doc Wiki.
To follow along with these steps, you can buy or download a trial of an Embarcadero developer tool with FireMonkey including Delphi, C++Builder and RAD Studio.
Add a TEdit to the Principal Layout to serve as the calculator display.
A calculator has many types of buttons:
In this case there is a total of 25 buttons. For easy using, the most important (the most used) buttons will be twice as big as the rest of the buttons. The important buttons are:Backspace, +, =, and 0. For this layout, a regular button is sized to 50 pixels in width and to 30 pixels in height.
For the memory buttons, add a TGridLayout to the Principal Layout.
The result should look like in the image at the right.
The manage input data buttons do not have the same width, so they are added to the form through another TFlowLayout. Add a TFlowLayoutto the Principal Layout.
+ and = are the most used operations, so the buttons for them are treated separately. For the rest of the operations, regular buttons are used.
The interface should look like in the following image.
Download Delphi XE7 now!
Get Free Trial
Webinars on demand!
More social media choices:
Delphi on Google+
@RADTools on Twitter
Server Response from: ETNASC04