·   Wiki Home
 ·   Wiki Help
 ·   Categories
 ·   Title List
 ·   Uncategorized Pages
 ·   Random Page
 ·   Recent Changes
 ·   RSS
 ·   Atom
 ·   What Links Here

Active Members:



Create or Find Page:


View About Elements

Return to MonkeyStyler

Element is the name for a style for a single control class. For example buttonstyle is the element which styles a TButton, checkboxstyle is the element which styles a TCheckBox.

A style file contains multiple elements. An element may contain one or more components each of which may have child components. Thus a single element is usually a tree of components.

The name of an element is specified in the StyleName property of it's root component.

By default FireMonkey will look for a style element for a component using the following algorithm:
Remove the preceding 'T'.
Append the word 'Style'.

This is how the default names checkboxstyle and buttonstyle are chosen for TCheckBox and TButton respectively in our earlier example.

If no style is found for a component using the formula above then FireMonkey will look for the default name of the parent class. E.g. given:
TChildEdit = class(TEdit

FireMonkey will look first for ChildEditStyle, then EditStyle.

However, it will not look further than the parent class name. E.g. given,
TGrandchildEdit = class(TChildEdit

FireMonkey will look for GrandchildEditStyle, then ChildEditStyle but won't try looking for EditStyle.

You can override this default behaviour by setting the StyleLookup property of your control.

Thus, if you want to change the style for every instance of a given class, modify the default style (e.g. ButtonStyle) for that class. But to use a different style for only some instances of a class, create a different style (E.g. RedButtonStyle) and set that name for the StyleLookup property you want to have that style.

The rules for constructing element names are the same as those of a valid Pascal identifier: An upper or lower case letter or underscore followed by zero or more of letters, numbers and underscores.

Element Management