Table of Contents

Class MenuButton

A button that brings up a PopupMenu when clicked.

Inheritance
MenuButton

A button that brings up a PopupMenu when clicked. To create new items inside this PopupMenu, use get_popup().add_item("My Item Name"). You can also create them directly from Godot editor's inspector.

See also BaseButton which contains common properties and methods associated with this node.

Properties

The number of items currently in the list.

var item_count : int = 0

Property Value

int
  • void set_item_count(int value)
  • int get_item_count

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.

var switch_on_hover : bool = false

Property Value

bool
  • void set_switch_on_hover(bool value)
  • bool is_switch_on_hover

Methods

Qualifiers: const

Returns the PopupMenu contained in this button.

Warning: 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 visible property.

PopupMenu get_popup

If true, shortcuts are disabled and cannot be used to trigger the button.

void set_disable_shortcuts(bool disabled)

Parameters

disabled bool

Adjusts popup position and sizing for the MenuButton, then shows the PopupMenu. Prefer this over using get_popup().popup().

void show_popup

Events

Emitted when the PopupMenu of this MenuButton is about to show.

signal about_to_popup