class_optionbutton - vkbsb/godot GitHub Wiki

OptionButton

####Inherits: Button ####Category: Core

Brief Description

Button control that provides selectable options when pressed.

Member Functions

Signals

  • item_selected ( int ID )

Description

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.

Member Function Description

add_item

Add an item, with text "label" and (optionally) id. If no "id" is passed, "id" becomes the item index. New items are appended at the end.

add_icon_item

Add an item, with a "texture" icon, text "label" and (optionally) id. If no "id" is passed, "id" becomes the item index. New items are appended at the end.

set_item_text

  • void set_item_text ( int idx, String text )

Set the text of an item at index "idx".

set_item_icon

Set the icon of an item at index "idx".

set_item_ID

  • void set_item_ID ( int idx, int id )

Set the ID of an item at index "idx".

get_item_text

Return the text of the item at index "idx".

get_item_icon

Return the icon of the item at index "idx".

get_item_ID

  • int get_item_ID ( int idx ) const

Return the ID of the item at index "idx".

get_item_count

  • int get_item_count ( ) const

Return the amount of items in the OptionButton.

add_separator

  • void add_separator ( )

Add a separator to the list of items. Separators help to group items. Separator also takes up an index and is appended at the end.

clear

  • void clear ( )

Clear all the items in the OptionButton.

select

  • void select ( int arg0 )

Select an item by index and make it the current item.

get_selected

  • int get_selected ( ) const

Return the current item index