FireMonkey Native Windows Controls

From RAD Studio
Jump to: navigation, search

Go Up to FireMonkey Native Controls


This topic describes the native Windows controls of FireMonkey.

FireMonkey Native Windows Control Presentation

FireMonkey provides native presentation for certain visual components.

  • Set the ControlType property to Styled in order to have the standard FireMonkey presentation of the control. Styled is the default value of ControlType.
  • Set the ControlType property to Platform to have the native styling of that control.

Available FireMonkey Native Windows Controls

The following list contains all the controls that support native presentation:

Visual Changes to Native Windows Controls

When the ControlType property of a visual component is set to Platform, the presentation of this control in the Form Designer changes to indicate that it is a native control and an small phone-like icon appears in the bottom right corner. The following images demonstrate the look of native Windows controls at with the ControlType property set to Styled and Platform, at design time and at run time:

Control Design time Run time
Styled Platform Styled Platform

TEdit

TEditStyled DT win.png

TEditPlatform DT win.png

TEditStyled RT win.png

TEditPlatform RT win.png

TMemo

TMemo Styled DT win.png

TMemo Platform DT win.png

TMemo Styled RT win.png

TMemo Platform RT win.png

TPresentedScrollBox

TPresentedScrollBox Styled DT.png

TPresentedScrollBox Platform DT.png

TPresentedScrollBox Styled RT win.png

TPresentedScrollBox Platform RT win.png

Adding Native Windows Controls to Your Application

To add native Windows controls to your application:

  1. Drop a component that supports native presentation on the form (list of supported controls).
  2. In the Object Inspector Properties, set the ControlType property to Platform. The presentation of the component at design-time changes (see Visual Changes to Native Windows Controls).
  3. Run your application.

Alternatively, you may change the value of ControlType at run time. To select the native presentation for a TEdit control, add the following code to your application:

Delphi:

Edit1.ControlType := TPresentedControl.TControlType.Platform;

C++:

Edit1->ControlType = TPresentedControl::TControlType::Platform;

Combining Native Windows Controls With Non-native Controls

We do not recommend that you combine non-native controls with native controls, because the native controls do not support the Z-order of the form: a native control is always on top of other controls on your form. However, there are some non-native controls that you may combine with native controls because they support the Z-order of native controls.

The following list contains all the controls that have the ControlType property and therefore may be combined with native controls:

The following list contains all the controls that do not have the ControlType property but may also be combined with native controls:

Advantages of the Native Windows Controls

Some controls support additional functionality when you use them as native controls:

TMemo and TEdit

  • Additional context-menu items:
    • Undo: Undo the last action.
    • Right to left Reading order: Changes the reading order and justifies text on the right side of the control. See Microsoft Documentation - To set right-to-left reading order for more information.
    • Show Unicode control characters: Shows Unicode control characters.
    • Insert a Unicode control character: Inserts a Unicode control character.
    • Open IME: IME stands for Microsoft Global Input Method Editor. It enables the typing of Japanese, Chinese and Korean into supporting applications on other versions of Windows.

The features above are provided in the context menu of the control, therefore the context menu of the memo control or the edit control is different for Styled and Platform:

Control Context menu (Styled) Context menu (Platform)

TMemo

TMemo ContextMenu Styled RT win.png

TMemo ContextMenu Platform RT win.png

TEdit

TEdit ContextMenu Styled RT win.png

TEdit ContextMenu Platform RT win.png

Limitations of Native Windows Controls

Before using the native controls, consider the following limitations:

  • Native controls do not support predefined or custom styles. When the ControlType property of a native control is set to Platform, the value of the StyleLookup property is ignored.
  • Native controls have limited support for transparent background. Transparent controls are not painted correctly.
  • Native controls do not support the Z-order of the form: a native control is always on top of other FireMonkey controls available on your form. See Combining Native Windows Controls With Non-native Controls for details.
  • The following event handlers are not supported and cannot be implemented:
  • The following events occur but you cannot use them as intended (to override the visualization of the control). However, you may use them as an indication of when the system repaints the control:

There are also some control-specific limitations:

TMemo

The following event is not supported and cannot be implemented in TMemo:

TMemo and TEdit

Setting parameter values in the OnKeyXX event handler does not suppress the key input. For example, if you set KeyChar := #0; in the OnKeyDown event handler and press the s key, the native presentation still outputs the s, while the styled presentation does not output anything.

The above limitation applies to these event handlers:

The following events are not supported and cannot be implemented in TMemo and TEdit:

  • OnValidate
Note: The OnValidating event occurs in both FireMonkey and native presentation of TMemo and TEdit.

See Also

Samples