Toolbar
- Last UpdatedDec 16, 2023
- 4 minute read
This topic is part of Specialized 2D Nodes.
Toolbar node
The Toolbar node enables you to create an icon menu. This flexible node enables implementation of different kinds of menus, such as option or item state. Items are defined inside the Toolbar tag.
Platform support
This node is supported on XR-Windows platform only.
|
XR-WIN |
XR-P-WIN |
XR-P-IOS |
XR-P-AND |
XR-P-WASM |
|---|---|---|---|---|
|
Full support |
No support |
No support |
No support |
No support |
|
|
|
|
|
|
Scroll mode
There are two scroll modes.
|
Mode |
Description |
|---|---|
|
Cursor |
Menu icons are presented in a row. The selector cursor moves left and right according to user interaction. When using this mode the fade is seldom set. |
|
Icons |
Menu icons are presented in a row with the cursor in the middle of them. When user moves left or right the selector stays still while the icons scrolls under it. When using this mode the fade is usually set.icons |
center Y
There are three centering options.
|
Option |
Description |
|---|---|
|
Center |
The selected item is zoomed from the center. |
|
Top |
The selected item is zoomed to keep its top aligned with those of unzoomed items. |
|
Bottom |
The selected item is zoomed to keep its bottom aligned with those of unzoomed items. |
Code example
This is a code example for the Toolbar node.
<Toolbar name="simulazione_menu" visible="false" selectorImage="simulazione\selector.png"
position="790 370"
itemSize="256 256"
gridSize="340 340"
fadeCells="1 2"
scrollMode="icons"
textFont="Arial,Bold,50"
textY="5" order="100">
<item name="si_exit" images="simulazione\menu_exit.png" text="Exit"/>
<item name="si_torch" images="simulazione\menu_torch_off.png,simulazione\menu_torch_on.png" field="simulazione_active_dpi.torch" text="@lang:dpi_torch@"/>
<toolbar/>
Toolbar fields
These are the fields for Toolbar node. Only the node-specific fields are indicated, not fields obtained by inheritance.
Field inheritance: NodeBase > Toolbar
|
Fields |
Type |
Use |
Default value |
Description |
|---|---|---|---|---|
|
fadeCells |
svec2 |
Optional |
0 0 |
Defines fading behavior. The X defines the distance from the selector in which the items are completely visible. The Y defines the distance from the selector at which the items become not visible. Both refers to multiplies of the grid width. 0 0 means that fading is not used. |
|
gridSize |
svec2 |
Optional |
200 200 |
Item grid dimension. Currently, only the width is used because the menu works only on one row and not on a grid. |
|
itemSelected |
sint |
Read only |
Internally calculated |
Index of the currently selected item. |
|
itemSize |
svec2 |
Optional |
128 128 |
Size of the menu item icons. |
|
moveCursorDelay |
sfloat |
Optional |
0 |
Minimum wait time between two accepted movements. |
|
moveCursorTime |
sfloat |
Optional |
0.3 |
Cursor or item scroll animation time, in seconds. |
|
moveCursorX |
sfloat |
Optional |
Not set |
Depending on the scrollMode causes the movement of the selector or of the items. Set 1 to move right and -1 to move left. Usually routed from the gamepad or keyboard. |
|
order |
sint |
Optional |
100 |
The node z order that defines the display order of different children. The range is 0-255. |
|
position |
svec2 |
Optional |
0 200 |
Position of the center of the toolbar, in reference to the screen top left corner. |
|
scrollMode |
senum |
Optional |
Cursor |
Defines the scroll mode between cursor and icons. |
|
scrollZoom |
sfloat |
Optional |
1.5 |
Zoom factor for the selected item. |
|
select |
sevent |
Optional |
Not set |
Performs selection action on the currently selected item. |
|
selectorImage |
sstring |
Optional |
Not set |
Name of the image for the menu selector. |
|
size |
svec2 |
Optional |
512 128 |
Size of the toolbar. |
|
textColor |
svec3 |
Optional |
1 1 1 |
Text color. The color is expressed in normalized (0-1) RGB (0 0 0 for black, 1 1 1 for white). |
|
textFont |
sstring |
Optional |
Arial,Bold,30 |
The font to use for text. The font name must be a system font. Only Bold and Regular parameters are accepted. |
|
textVisible |
sbool |
Optional |
true |
Specifies whether the item name displays under selected item. |
|
textY |
sfloat |
Optional |
0 |
Vertical offset for text displaying under an item. |
|
visible |
sbool |
Optional |
false |
Sets or gets the toolbar visibility state. |
Item
The fields of the items of a Toolbar can be accessed with the syntax: toolbarName.itemName_itemField
Example: simulazione_menu.si_torch_active
|
Attribute |
Type |
Use |
Default value |
Description |
|---|---|---|---|---|
|
active |
sbool |
Optional |
true |
If set to false, the item is not presented in the menu. |
|
enabled |
sbool |
Optional |
true |
If set to false, the item does not react to the selection of the user. |
|
field |
sstring |
Optional |
Not set |
If set, the item state automatically copies to that field. |
|
images |
mstring |
Mandatory |
Not set |
List of images for the different item states, such Not selected, Selected. The number of images define the number of item states. |
|
name |
sstring |
Optional |
Progressive |
Automatic name. This value is mandatory. Otherwise the node is not referenceable. |
|
select |
sevent |
Internally calculated |
Not set |
Raised when the item is selected. |
|
state |
sint |
Optional |
0 |
Sets/gets item state. |
|
text |
sstring |
Optional |
Null |
Text to display under the item. |