Inherits: Button < BaseButton < Control < CanvasItem < Node < Object
Special button that brings up a PopupMenu when clicked.
Special button that brings up a PopupMenu when clicked.
New items can be created inside this PopupMenu using get_popup().add_item("My Item Name")
. You can also create them directly from the editor. To do so, select the MenuButton
node, then in the toolbar at the top of the 2D editor, click Items then click Add in the popup. You will be able to give each items new properties.
ActionMode | action_mode |
0 (parent override)
|
FocusMode | enabled_focus_mode |
0 (parent override)
|
bool | flat |
true (parent override)
|
FocusMode | focus_mode |
0 (parent override)
|
bool | switch_on_hover | false |
bool | toggle_mode |
true (parent override)
|
PopupMenu | get_popup ( ) const |
void | set_disable_shortcuts ( bool disabled ) |
StyleBox | disabled | |
StyleBox | focus | |
Font | font | |
Color | font_color | Color( 0.88, 0.88, 0.88, 1 ) |
Color | font_color_disabled | Color( 1, 1, 1, 0.3 ) |
Color | font_color_hover | Color( 0.94, 0.94, 0.94, 1 ) |
Color | font_color_pressed | Color( 1, 1, 1, 1 ) |
StyleBox | hover | |
int | hseparation | 3 |
StyleBox | normal | |
StyleBox | pressed |
Emitted when PopupMenu of this MenuButton is about to show.
Default | false |
Setter | set_switch_on_hover(value) |
Getter | is_switch_on_hover() |
If true
, when the cursor hovers above another MenuButton
within the same parent which also has switch_on_hover
enabled, it will close the current MenuButton
and open the other one.
Returns the PopupMenu contained in this button.
If true
, shortcuts are disabled and cannot be used to trigger the button.
© 2014–2020 Juan Linietsky, Ariel Manzur, Godot Engine contributors
Licensed under the MIT License.
https://docs.godotengine.org/en/3.2/classes/class_menubutton.html