MenuButton
繼承: Button < BaseButton < Control < CanvasItem < Node < Object
點擊後會彈出 PopupMenu 的按鈕。
說明
點擊後會彈出 PopupMenu 的按鈕。可以使用 get_popup().add_item("功能表專案名稱") 在這個 PopupMenu 中建立新的功能表專案,也可以直接從 Godot 編輯器的屬性檢視器中建立。
另見 BaseButton,提供了與該節點相關的常用屬性和方法。
屬性
action_mode |
|
|
flat |
|
|
focus_mode |
|
|
|
||
|
||
toggle_mode |
|
方法
get_popup() const |
|
void |
set_disable_shortcuts(disabled: bool) |
void |
訊號
about_to_popup() 🔗
該 MenuButton 的 PopupMenu 即將顯示時發出。
屬性說明
目前列表中的專案數。
bool switch_on_hover = false 🔗
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.
方法說明
返回這個按鈕中包含的 PopupMenu。
警告:這是一個必需的內部節點,移除和釋放它可能會導致當機。如果你想隱藏它或它的任何子節點,請使用其 Window.visible 屬性。
void set_disable_shortcuts(disabled: bool) 🔗
如果為 true,快捷方式將被禁用,無法用於觸發按鈕。
void show_popup() 🔗
調整該 MenuButton 的彈出位置和大小,然後顯示該 PopupMenu。請優先使用此方法,而不是使用 get_popup().popup()。