new Selector()
Properties:
Name | Type | Description |
---|---|---|
image |
string | The path to the current image (or a PNG as a string representation) |
icon |
Image | The Image currently displayed |
label |
StaticText | The current text |
items |
Array.<DuButton> | The buttons |
index |
int | The current index |
text |
string | The current text |
onChange |
Selector~onChange | The function to execute when the index changes. You can set your own function here, which must take no argument. The method is called after the index has changed. |
onRefresh |
Selector~onRefresh | The function to execute when the refresh button is clicked. You can set your own function here, which must take no argument. |
Methods
-
static addButton(textopt, imageopt, helpTipopt, imageOveropt, localizeopt)
-
Adds a new button to the selector
Parameters:
Name Type Attributes Default Description text
string <optional>
The text displayed by the button image
string <optional>
The icon, either a path to the file or a PNG represented as a string. helpTip
string <optional>
The help tip imageOver
string <optional>
The roll over icon, either a path to the file or a PNG represented as a string. localize
boolean <optional>
true Set to false if the text must not be translated. -
static clear()
-
Removes all buttons from the selector. This is the same as
Selector.removeAll
. -
static removeAll()
-
Removes all buttons from the selector. This is the same as
Selector.clear
. -
static setCurrentIndex(index)
-
Changes the selection and the current index of the selector
Parameters:
Name Type Description index
int The new index -
static setCurrentText(text)
-
Changes the selection and the current index of the selector, using the text of the selection
Parameters:
Name Type Description text
string The text to select
Type Definitions
-
onChange()
-
The function to execute when the index changes.
The method is called after the index has changed. -
onRefresh()
-
The function to execute when the refresh button is clicked.