FireMonkey Primitive Controls and Styled Controls
Go Up to FireMonkey Components Guide
Primitive Controls
FireMonkey primitive controls are inherited from FMX.Objects.TShape, and therefore they know how to draw themselves. Drawing is done by the Paint method, which is introduced at FMX.Controls.TControl and then overwritten by each primitive control.
The look and feel of a primitive control is defined by its own properties, such as Fill or Stroke.
Here are the FireMonkey primitive controls:
- FMX.Objects.TLine
- FMX.Objects.TRectangle
- FMX.Objects.TRoundRect
- FMX.Objects.TEllipse
- FMX.Objects.TCircle
- FMX.Objects.TArc
- FMX.Objects.TCustomPath
- FMX.Objects.TText
Creating a FireMonkey Primitive Control presents step-by-step instructions for creating your own FireMonkey primitive control.
Styled Controls
FireMonkey styled controls do not define a look and feel. Instead, they read style files (or styles defined by a stylebook component) to dynamically select a list of primitive controls with their properties. Thus, styled controls can change look and feel when the application switches to a new style (load new style definitions).
A styled control can be built of any combination of primitive controls, styled controls, and effects. For example, FMX.StdCtrls.TCheckBox is built of the following primitive controls and effects:
- TLayout (CheckBoxstyle)
- TLayout
- TRectangle (background)
- TGlowEffect
- TRectangle
- TRectangle
- TColorAnimation
- TColorAnimation
- TPath (checkmark)
- TColorAnimation
- TText (text)
- TRectangle (background)
- TLayout
When a styled control is loaded, an object is loaded with
StyleName = '<classname>style'
Then the control is constructed. For example:
objectTLayout
StyleName = 'checkboxstyle'
Position.Point = '(352,391)'
Width = 121.000000000000000000
Height = 21.000000000000000000
objectTLayout
Align = Left
Width = 20.000000000000000000
Height = 21.000000000000000000
objectTRectangle
StyleName = 'background'
Align = Center
Position.Point = '(3,4)'
Locked = True
Width = 13.000000000000000000
Height = 13.000000000000000000
HitTest = False
Fill.Color = xFFEFEFEF
Stroke.Kind = None
objectTGlowEffect
Trigger = 'IsFocused=true'
Enabled = False
Softness = 0.200000002980232200
GlowColor = x82005ACC
Opacity = 0.899999976158142100
end
objectTRectangle
Align = Contents
Locked = True
Width = 13.000000000000000000
Height = 13.000000000000000000
HitTest = False
Fill.Kind = Gradient
Fill.Gradient.Points = <
item
Color = x5FA7A7A7
end
item
Color = x5FFFFFFF
Offset = 1.000000000000000000
end>
Stroke.Color = x90404040
end
objectTRectangle
Align = Contents
Position.Point = '(2,2)'
Locked = True
Width = 9.000000000000000000
Height = 9.000000000000000000
Padding.Rect = '(2,2,2,2)'
HitTest = False
Fill.Kind = None
Stroke.Color = x30505050
end
objectTColorAnimation
Duration = 0.100000001490116100
Trigger = 'IsMouseOver=true'
StartValue = xFFEFEFEF
StopValue = xFFA5D9FF
PropertyName = 'Fill.Color'
end
objectTColorAnimation
Duration = 0.100000001490116100
Inverse = True
Trigger = 'IsMouseOver=false'
StartValue = xFFEFEFEF
StopValue = xFFA5D9FF
PropertyName = 'Fill.Color'
end
objectTPath
StyleName = 'checkmark'
Align = Center
Position.Point = '(2,2)'
Locked = True
Width = 9.000000000000000000
Height = 9.000000000000000000
HitTest = False
Fill.Color = claNull
Stroke.Kind = None
Data.Path = {
1200000000000000000000000000000001000000CDCC4C3E0000000001000000
0000003F9A99993E01000000CDCC4C3F00000000010000000000803F00000000
010000000000803FCDCC4C3E010000003333333F0000003F010000000000803F
CDCC4C3F010000000000803F0000803F01000000CDCC4C3F0000803F01000000
0000003F3333333F01000000CDCC4C3E0000803F01000000000000000000803F
0100000000000000CDCC4C3F010000009A99993E0000003F0100000000000000
CDCC4C3E010000000000000000000000030000000000000000000000}
objectTColorAnimation
Duration = 0.100000001490116100
Trigger = 'IsChecked=true'
TriggerInverse = 'IsChecked=false'
StartValue = x00034E9E
StopValue = xFF034E9E
PropertyName = 'Fill.Color'
end
end
end
end
objectTText
StyleName = 'text'
Align = Client
Position.Point = '(21,2)'
Locked = True
Width = 99.000000000000000000
Height = 19.000000000000000000
Padding.Rect = '(1,2,1,0)'
HitTest = False
Text = 'CheckBox'
end
end