Pseudo selectors
Pseudo selectors can be used to apply style only when some conditions are fulfilled.
Pseudo selectors are preceded by a colon and can be combined:
<Style name="Table:even:input" >
<Style name="Edit:focus" >
<Style name="Edit.important:focus" >
When combining several pseudo selectors, the style will be applied if all pseudo selector conditions are fulfilled.
Note: Depending on the type of the front-end, some pseudo selectors are meaningless, or
unsupported. See the table below to check which pseudo selectors are supported on your front-end
platform.
Pseudo selectors have different priorities; the style with the most important pseudo selector will be used when several styles match.
Priority | Pseudo selectors | Condition | GDC | GBC | GMA | GMI |
---|---|---|---|---|---|---|
1 |
focus
|
The widget has the focus | Yes | Yes | Yes | Yes |
2 |
query
|
The widget is in construct mode | Yes | Yes | Yes | Yes |
3 |
display
|
The widget is in a display array | Yes | Yes | Yes | Yes |
4 |
input
|
The widget is in an input array, input or construct | Yes | Yes | Yes | Yes |
5 |
even
|
This widget is on an even row if in a list (Table or Tree) | Yes | Yes | No | No |
6 |
odd
|
This widget is on an odd row if in a list (Table or Tree) | Yes | Yes | No | No |
7 |
inactive
|
The widget is inactive | Yes | Yes | Yes | Yes |
8 |
active
|
The widget is active | Yes | Yes | Yes | Yes |
9 |
message
|
Applies only to text displayed with the MESSAGE instruction |
Yes | Yes | Yes | Yes |
10 |
error
|
Applies only to text displayed with the ERROR instruction |
Yes | Yes | Yes | Yes |
11 |
summaryLine
|
Applies only to text displayed in AGGREGATE fields of
tables |
Yes | Yes | No | No |
Pseudo selectors also define the priority of your styles. A more generic style will be used when the pseudo-selector has a higher priority.
For instance: you want all important edits to have red text, but
you want the current field to be displayed in blue:
<Style name="Edit.important" >
<Style name=":focus" >
The style ":focus
" is more generic than "Edit.important
";
therefore, it will be used for the focused item, as the pseudo
selector is more precise.