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.

ButtonGroup

繼承: Resource < RefCounted < Object

不允許同時按下多個按鈕的按鈕的一個群組。

說明

BaseButton 衍生按鈕的群組。ButtonGroup 中的按鈕被視為選項按鈕:同一時間最多只能按下一個按鈕。某些型別的按鈕(例如 CheckBox)在該狀態下可能會有特殊的外觀。

ButtonGroup 的每個成員都應該將 BaseButton.toggle_mode 設定為 true

屬性

bool

allow_unpress

false

bool

resource_local_to_scene

true (overrides Resource)

方法

Array[BaseButton]

get_buttons()

BaseButton

get_pressed_button()


訊號

pressed(button: BaseButton) 🔗

當該組中的某個按鈕被按下時發出。


屬性說明

bool allow_unpress = false 🔗

  • void set_allow_unpress(value: bool)

  • bool is_allow_unpress()

如果為 true,則可以取消按下該 ButtonGroup 中的所有按鈕。


方法說明

Array[BaseButton] get_buttons() 🔗

返回元素型別為 ButtonArray,這些 Button 將其作為 ButtonGroup(見 BaseButton.button_group)。


BaseButton get_pressed_button() 🔗

返回目前按下的按鈕。