Constructor
new Select(gui, name, labelStr, options, defaultIndex, valueCallback, setupCallbackopt)
Constructor for Select.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
gui |
GUI | ||
name |
string | ||
labelStr |
string | ||
options |
Array | ||
defaultIndex |
number | ||
valueCallback |
function | ||
setupCallback |
function |
<optional> |
- Source:
Extends
Members
_doUpdateChangeSet :boolean
Static flag to control whether the change set should be updated.
Type:
- boolean
- Overrides:
- Source:
console :p5.Element
The console div element for displaying messages.
Type:
- p5.Element
- Overrides:
- Source:
consoleText :string
The current console text.
Type:
- string
- Overrides:
- Source:
controllerElement :p5.Element|HTMLElement
The HTML element representing the controller.
Type:
- p5.Element | HTMLElement
- Overrides:
- Source:
controllerWrapper :p5.Element
The wrapper div for the controller.
Type:
- p5.Element
- Overrides:
- Source:
die :DieIcon
The die icon for randomization.
Type:
- Overrides:
- Source:
doRandomize :boolean
Flag to control whether the controller should randomize its value.
Type:
- boolean
- Overrides:
- Source:
gui :GUIForP5
The GUIForP5 instance this controller belongs to.
Type:
- Overrides:
- Source:
label :string
The label for the controller.
Type:
- string
- Overrides:
- Source:
name :string
The name of the controller.
Type:
- string
- Overrides:
- Source:
optionStrs :Array.<string>
The string representations of the options.
Type:
- Array.<string>
- Source:
options :Array
The options for the select.
Type:
- Array
- Source:
setupCallback :function
Optional setup callback.
Type:
- function
- Overrides:
- Source:
value :*
The value of the controller.
Type:
- *
- Overrides:
- Source:
valueCallback :function
The value callback.
Type:
- function
- Source:
Methods
addDie(die)
Adds a die to the controller.
Parameters:
Name | Type | Description |
---|---|---|
die |
DieIcon | The die to add. |
- Overrides:
- Source:
addToRandomizer(randomizer)
Adds this controller to a randomizer.
Parameters:
Name | Type | Description |
---|---|---|
randomizer |
Randomizer | The randomizer to add this controller to. |
- Overrides:
- Source:
afterSetOptions()
Called after setting options.
- Source:
createConsole()
Creates the console element for the controller.
- Overrides:
- Source:
disable()
Disables the controller.
- Overrides:
- Source:
doUpdateChangeSet() → {boolean}
Checks if the change set should be updated.
- Overrides:
- Source:
Returns:
- True if the change set should be updated, false otherwise.
- Type
- boolean
enable()
Enables the controller.
- Overrides:
- Source:
getValueForJSON() → {*}
Gets the value for JSON serialization.
- Overrides:
- Source:
Returns:
- Type
- *
hasOption(option) → {boolean}
Checks if an option exists.
Parameters:
Name | Type | Description |
---|---|---|
option |
* |
- Source:
Returns:
- Type
- boolean
hasOptionStr(optionStr) → {boolean}
Checks if an option string exists.
Parameters:
Name | Type | Description |
---|---|---|
optionStr |
string |
- Source:
Returns:
- Type
- boolean
hide()
Hides this field by setting its display to 'none'.
- Overrides:
- Source:
isDisabled() → {boolean}
Checks if the controller is disabled.
- Overrides:
- Source:
Returns:
- True if the controller is disabled, false otherwise.
- Type
- boolean
isHidden() → {boolean}
Checks if this field is currently hidden.
- Overrides:
- Source:
Returns:
True if the field is hidden, false otherwise.
- Type
- boolean
optionToString(option) → {string}
Converts an option to a string.
Parameters:
Name | Type | Description |
---|---|---|
option |
* |
- Source:
Returns:
- Type
- string
randomize()
Randomizes the select value.
- Overrides:
- Source:
setConsole(text, typeopt)
Sets the console text and type.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
text |
string | The text to display in the console. |
|
type |
string |
<optional> |
The type of message ('error', 'warning', etc.). |
- Overrides:
- Source:
setDisabled(doSetDisabled)
Sets the disabled state of the controller.
Parameters:
Name | Type | Description |
---|---|---|
doSetDisabled |
boolean | True to disable the controller, false to enable it. |
- Overrides:
- Source:
setError(text)
Sets the error message in the console.
Parameters:
Name | Type | Description |
---|---|---|
text |
string | The error message to display. |
- Overrides:
- Source:
setOptions(options)
Sets the options for the select.
Parameters:
Name | Type | Description |
---|---|---|
options |
Array |
- Source:
setText(text)
Sets the text content of this field.
Parameters:
Name | Type | Description |
---|---|---|
text |
string | The new text content for the field. |
- Overrides:
- Source:
setTooltip(tooltip)
Sets the tooltip text for this field.
Parameters:
Name | Type | Description |
---|---|---|
tooltip |
string | The tooltip text to set. |
- Overrides:
- Source:
setValue(option)
Sets the value of the select.
Parameters:
Name | Type | Description |
---|---|---|
option |
* |
- Overrides:
- Source:
setWarning(text)
Sets the warning message in the console.
Parameters:
Name | Type | Description |
---|---|---|
text |
string | The warning message to display. |
- Overrides:
- Source:
setup()
Setup for the controller.
- Overrides:
- Source:
show()
Shows this field by setting its display to '' (default).
- Overrides:
- Source: