Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
MenuButton
Eredita: Button < BaseButton < Control < CanvasItem < Node < Object
Un pulsante che apre un PopupMenu quando viene cliccato.
Descrizione
Un pulsante che apre un PopupMenu quando viene cliccato. Per creare nuove voci all'interno di questo PopupMenu, usa get_popup().add_item("My Item Name"). Puoi anche crearli direttamente dall'ispettore dell'editor Godot.
Vedi anche BaseButton che contiene le proprietà e i metodi comuni associati a questo nodo.
Proprietà
action_mode |
|
|
flat |
|
|
focus_mode |
|
|
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
toggle_mode |
|
Metodi
get_popup() const |
|
void |
set_disable_shortcuts(disabled: bool) |
void |
Segnali
about_to_popup() 🔗
Emesso quando il PopupMenu di questo MenuButton sta per essere mostrato.
Descrizioni delle proprietà
Il numero di elementi attualmente nell'elenco.
int popup/item_{index}/checkable = 0 🔗
The checkable item type of the item at index.
Note: index is a value in the 0 .. item_count - 1 range.
bool popup/item_{index}/checked = false 🔗
Se true, l'elemento all'indice index è spuntato.
Note: index è un valore compreso tra 0 .. item_count - 1.
bool popup/item_{index}/disabled = false 🔗
If true, the item at index is disabled.
Note: index is a value in the 0 .. item_count - 1 range.
Texture2D popup/item_{index}/icon 🔗
The icon of the item at index.
Note: index is a value in the 0 .. item_count - 1 range.
int popup/item_{index}/id = 0 🔗
The ID of the item at index.
Note: index is a value in the 0 .. item_count - 1 range.
bool popup/item_{index}/separator = false 🔗
If true, the item at index is a separator.
Note: index is a value in the 0 .. item_count - 1 range.
String popup/item_{index}/text = "" 🔗
The text of the item at index.
Note: index is a value in the 0 .. item_count - 1 range.
bool switch_on_hover = false 🔗
Se true, quando il cursore passa sopra un altro MenuButton all'interno dello stesso genitore che ha anche switch_on_hover abilitato, chiuderà il MenuButton attuale e aprirà l'altro.
Descrizioni dei metodi
Restituisce il PopupMenu contenuto in questo pulsante.
Warning: Questo è un nodo interno obbligatorio, rimuoverlo e liberarlo potrebbe causare un arresto anomalo. Se desideri nasconderlo o nascondere uno dei suoi figli, usa la loro proprietà Window.visible.
void set_disable_shortcuts(disabled: bool) 🔗
Se true, le scorciatoie sono disabilitate e non possono essere utilizzate per attivare il pulsante.
void show_popup() 🔗
Regola la posizione e le dimensioni di popup per il MenuButton, quindi mostra il PopupMenu. Preferisci usare questo metodo piuttosto che get_popup().popup().