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 [code]get_popup().add_item("My Item Name")[/code]. 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 [b]Items[/b] then click [b]Add[/b] in the popup. You will be able to give each item new properties.
See also [BaseButton] which contains common properties and methods associated with this node.
Returns the [PopupMenu] contained in this button.
[b]Warning:[/b] This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their [member Window.visible] property.
If [code]true[/code], shortcuts are disabled and cannot be used to trigger the button.
The number of items currently in the list.
If [code]true[/code], when the cursor hovers above another [MenuButton] within the same parent which also has [code]switch_on_hover[/code] enabled, it will close the current [MenuButton] and open the other one.
Emitted when the [PopupMenu] of this MenuButton is about to show.
Default text [Color] of the [MenuButton].
Text [Color] used when the [MenuButton] is disabled.
Text [Color] used when the [MenuButton] is focused. Only replaces the normal text color of the button. Disabled, hovered, and pressed states take precedence over this color.
Text [Color] used when the [MenuButton] is being hovered.
The tint of text outline of the [MenuButton].
Text [Color] used when the [MenuButton] is being pressed.
The horizontal space between [MenuButton]'s icon and text. Negative values will be treated as [code]0[/code] when used.
The size of the text outline.
[Font] of the [MenuButton]'s text.
Font size of the [MenuButton]'s text.
[StyleBox] used when the [MenuButton] is disabled.
[StyleBox] used when the [MenuButton] is focused. The [code]focus[/code] [StyleBox] is displayed [i]over[/i] the base [StyleBox], so a partially transparent [StyleBox] should be used to ensure the base [StyleBox] remains visible. A [StyleBox] that represents an outline or an underline works well for this purpose. To disable the focus visual effect, assign a [StyleBoxEmpty] resource. Note that disabling the focus visual effect will harm keyboard/controller navigation usability, so this is not recommended for accessibility reasons.
[StyleBox] used when the [MenuButton] is being hovered.
Default [StyleBox] for the [MenuButton].
[StyleBox] used when the [MenuButton] is being pressed.