Converting from VCL to FireMonkey
Go Up to FireMonkey Applications Guide
Differences Between VCL and FireMonkey Applications
The VCL (Visual Component Library) supports only Windows-based development—both the Win32 and the Win64 platforms. FireMonkey components, on the other hand, have been customized for use on all the supported platforms, including the OS X (Mac) platform.
FireMonkey is only somewhat similar to the VCL library; FireMonkey and VCL share ancestry from TObject to TComponent, but they diverge beyond TComponent. If you are familiar with the VCL, some of the classes, components, controls, and functions in FireMonkey will be familiar. However, FireMonkey is a new framework that offers vector-based dynamic controls, and other features that the VCL does not offer. For example, FireMonkey has sophisticated 2D and 3D graphics, and special effects such as filters.
Migrating VCL Applications to FireMonkey
There is no direct migration path between the VCL and FireMonkey.
Using the Mida Converter to Convert a VCL Application to FireMonkey
The Mida Converter is a third-party product that automates some of the conversion of VCL controls to FireMonkey controls. Mida installs as a plug-in to the Tools menu in the RAD Studio IDE.
Several versions of Mida are available:
- The free version of Mida migrates standard VCL controls and LiveBindings.
- For the free version, see http://cc.embarcadero.com/item/28943
- The Mida Pro and Mida Studio versions offer enhanced functionality, such as conversion of custom controls and images.
The Mida pack enables support for button images like the VCL TBitBtn component.
The Mida home page offers more information, including blogs, FAQs, and product orders: http://www.midaconverter.com/
List of Commonly Encountered Differences
Although FMX is designed to have some superficial similarity with VCL, numerous small differences can trip up someone that is familiar with VCL. These include, in no particular order:
- Standard VCL controls are in the Vcl.StdCtrls unit, while equivalent FireMonkey controls are in FMX.Controls. Both have extra controls in an ExtCtrls unit, but with no overlap.
- The position of a VCL control is expressed by its Top and Left properties. FireMonkey controls use a Position of type TPosition with nested X and Y properties. 3D controls' Position property is an instance of TPosition3D, with an additional Z coordinate. FireMonkey uses Width and Height (and Depth) for size.
- The text that appears in a FireMonkey label is its Text, not its Caption (as in VCL).
- Font sizes in FMX are expressed in device-independent pixels (DIPs), 96 per logical inch. Font sizes in VCL are expressed in points, 72 per logical inch. Therefore, text using the same Font.Size is smaller in FireMonkey.
- Checkboxes should use the OnChange event to react to checked-state changes instead of OnClick. The property that reflects that state is named IsChecked, not Checked as in VCL.
- FireMonkey colors have an alpha (opacity) component in addition to RGB. Colors are represented by types TAlphaColor and TAlphaColorRec. Color constants are in FMX.Types and prefixed with "cla" instead of "cl".
- Other constants like modal results and virtual key codes have moved from Vcl.Controls to System.UITypes.