Button control that provides selectable options when pressed.
OptionButton is a type button that provides a selectable list of items when pressed. The item selected becomes the "current" item and is displayed as the button text.
See also [BaseButton] which contains common properties and methods associated with this node.
Adds an item, with a [code]texture[/code] icon, text [code]label[/code] and (optionally) [code]id[/code]. If no [code]id[/code] is passed, the item index will be used as the item's ID. New items are appended at the end.
Adds an item, with text [code]label[/code] and (optionally) [code]id[/code]. If no [code]id[/code] is passed, the item index will be used as the item's ID. New items are appended at the end.
Adds a separator to the list of items. Separators help to group items. Separator also takes up an index and is appended at the end.
Clears all the items in the [OptionButton].
Returns the amount of items in the OptionButton, including separators.
Returns the icon of the item at index [code]idx[/code].
Returns the ID of the item at index [code]idx[/code].
Returns the index of the item with the given [code]id[/code].
Retrieves the metadata of an item. Metadata may be any type and can be used to store extra information about an item, such as an external string ID.
Returns the text of the item at index [code]idx[/code].
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 CanvasItem.visible] property.
Returns the ID of the selected item, or [code]0[/code] if no item is selected.
Gets the metadata of the selected item. Metadata for items can be set using [method set_item_metadata].
Returns [code]true[/code] if the item at index [code]idx[/code] is disabled.
Removes the item at index [code]idx[/code].
Selects an item by index and makes it the current item. This will work even if the item is disabled.
Sets whether the item at index [code]idx[/code] is disabled.
Disabled items are drawn differently in the dropdown and are not selectable by the user. If the current selected item is set as disabled, it will remain selected.
Sets the icon of the item at index [code]idx[/code].
Sets the ID of the item at index [code]idx[/code].
Sets the metadata of an item. Metadata may be of any type and can be used to store extra information about an item, such as an external string ID.
Sets the text of the item at index [code]idx[/code].
The index of the currently selected item, or [code]-1[/code] if no item is selected.
Emitted when the user navigates to an item using the [code]ui_up[/code] or [code]ui_down[/code] actions. The index of the item selected is passed as argument.
Emitted when the current item has been changed by the user. The index of the item selected is passed as argument.
Default text [Color] of the [OptionButton].
Text [Color] used when the [OptionButton] is disabled.
Text [Color] used when the [OptionButton] 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 [OptionButton] is being hovered.
Text [Color] used when the [OptionButton] is being pressed.
The horizontal space between the arrow icon and the right edge of the button.
The horizontal space between [OptionButton]'s icon and text.
[Font] of the [OptionButton]'s text.
The arrow icon to be drawn on the right end of the button.
[StyleBox] used when the [OptionButton] is disabled.
[StyleBox] used when the [OptionButton] is focused. It is displayed over the current [StyleBox], so using [StyleBoxEmpty] will just disable the focus visual effect.
[StyleBox] used when the [OptionButton] is being hovered.
Default [StyleBox] for the [OptionButton].
[StyleBox] used when the [OptionButton] is being pressed.