Commonly Encountered Differences Between the VCL and FireMonkey

From RAD Studio
Jump to: navigation, search

Go Up to GUI Application Frameworks


Although FireMonkey is designed to have some superficial similarity with the VCL, numerous small differences can trip up someone that is familiar with the VCL. This topic covers some of those differences.

Actions

Unlike VCL actions, FireMonkey actions do not support an action manager. Therefore, you can not use the VCL Action Manager editor to manage FireMonkey actions.

Check Boxes

In FireMonkey, check boxes should use the OnChange event instead of OnClick to react to the changes of the checked state. The property that reflects that state is IsChecked, not Checked as in the VCL.

Child-Parent Relationships

In the VCL, objects parenting other components can be done only through TForms, TFrames, TPanels and Data Modules. In FireMonkey, you can parent any object to anything else, and this relationship can be easily established in the Structure View.

Colors

FireMonkey colors have an alpha (opacity) component in addition to RGB. Colors are represented by system types TAlphaColor and TAlphaColorRec. FireMonkey uses color constants from the System.UIConsts unit. These color constants are prefixed with "cla" instead of "cl". Also, see Colors in the VCL.

Control Positioning

In the VCL, the position of a control is expressed by its Top and Left properties.

In 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. For size, FireMonkey uses Width and Height (and Depth for 3D controls).

Database Grid Events

The VCL events OnDrawDataCell or OnDrawColumnCell can be replaced in FireMonkey with TStringGrid with LiveBindings.

Display Text

The text that appears in a FireMonkey label is its Text, not its Caption (as in the VCL).

Font Size

In the VCL, font sizes are expressed in points, 72 per logical inch.

In FireMonkey, font sizes are expressed in device-independent pixels (DIPs), 96 per logical inch.

Therefore, text using the same Font.Size is smaller in FireMonkey.

Masked Edit

A TMaskEdit or a TEdit in the VCL can be implemented in FireMonkey using a TEdit and its Password property.

Radio Buttons and Groups

To convert the VCL TRadioGroup to FireMonkey, you can use either TPanel or TGroupBox.

Note: In FireMonkey, items as radio buttons are not supported in TPanel.

The radio buttons in each VCL TGroupBox are independent. If you convert multiple VCL TGroupBox to FireMonkey TGroupBox, the containing radio buttons become dependant (selection in one group clear selection in other groups). To restore independence in FireMonkey, manually specify GroupName property for each converted TRadioButton.

See Also