PopupMenu
A list of commands that opens where you click, such as a right-click menu: Load, Rename, a divider, Delete. It opens with its corner at that point rather than centred like a Dropdown, and clicking anywhere closes it. Goes under a Canvas.
On this page
Add it
+ Add node → Popup Menu creates a node with it already on. Already have a node for it? Add component → PopupMenuComponent.
From a script
A script on the same node writes these fields by name. PopupMenuComponent is the name to pass.
rgs
set_text("PopupMenuComponent", "opens", "");
set_number("PopupMenuComponent", "width", 160.0);
set_number("PopupMenuComponent", "item_height", 28.0);
set_number("PopupMenuComponent", "separator_height", 9.0);
set_number("PopupMenuComponent", "shortcut_width", 56.0);
set_number("PopupMenuComponent", "scale", 1.0);
set_number("PopupMenuComponent", "border", 0.0);
set_point("PopupMenuComponent", "padding", vec2(0.0, 0.0));
set_colour("PopupMenuComponent", "background", vec4(0.1, 0.1, 0.13, 1.0));
set_colour("PopupMenuComponent", "highlight", vec4(0.25, 0.25, 0.32, 1.0));
set_colour("PopupMenuComponent", "foreground", vec4(0.9, 0.9, 0.94, 1.0));
set_colour("PopupMenuComponent", "disabled", vec4(0.45, 0.45, 0.5, 1.0));
set_colour("PopupMenuComponent", "rule", vec4(0.3, 0.3, 0.36, 1.0)); Fields
| Field | Script name | Kind | Default | What it does | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Items | items | list | 1 entries | The rows, in order. | ||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||
| Opens | opens | text | empty | Action whose click opens this menu. | ||||||||||||||||||||||||||||||
| Width | width | number, at least 1 | 160 px | How wide the menu opens, in UI units. | ||||||||||||||||||||||||||||||
| Item Height | item_height | number, at least 1 | 28 px | Height of a command row, in UI units. | ||||||||||||||||||||||||||||||
| Separator Height | separator_height | number, at least 0 | 9 px | Height of a separator row, in UI units. | ||||||||||||||||||||||||||||||
| Shortcut Width | shortcut_width | number, at least 0 | 56 px | Room kept at the right of every row for its shortcut key, in UI units. | ||||||||||||||||||||||||||||||
| Scale | scale | number, at least 0 | 1 | Scales the size of the text for a row's label and its shortcut key. | ||||||||||||||||||||||||||||||
| Texture | texture | asset | none | A picture to draw the menu on, or none for a flat fill. | ||||||||||||||||||||||||||||||
| Border | border | number, at least 0 | 0 px | Width of the picture's nine-slice border, so its corners keep their size as the menu grows. | ||||||||||||||||||||||||||||||
| Padding | padding | two numbers (x, y) | (0, 0) | How far the rows sit inside the menu's edge, across and down, and the words inside their row. | ||||||||||||||||||||||||||||||
| Colors | ||||||||||||||||||||||||||||||||||
| Background | background | colour | #1a1a21 | Background of the whole menu. | ||||||||||||||||||||||||||||||
| Highlight | highlight | colour | #404052 | Highlight behind the row under the pointer or the ring. | ||||||||||||||||||||||||||||||
| Foreground | foreground | colour | #e6e6f0 | Colour of an item's label. | ||||||||||||||||||||||||||||||
| Disabled | disabled | colour | #737380 | Colour of a label that cannot be chosen. | ||||||||||||||||||||||||||||||
| Rule | rule | colour | #4d4d5c | Colour of the line a separator draws. | ||||||||||||||||||||||||||||||