Skip to end of metadata
Go to start of metadata

TextCycler

 

Combines a variety of core objects to create a simple control that is analgous to a web browser's radio group. Allows you to present a list of options for input. Recommended for lists with fewer than 10 options.


Require Extended Library: 

 

 

Class Constructor

new TextCycler

Creates a new TextCycler object.

 

Initialization Parameters

 

NameRequiredTypeDefaultDescription
options
Yes
array
 

Each element of the option array should be an object with a key of 'value' and a key of 'display.'

[{
    'value'   : '1',
    'display' : 'Lead off Man'
}, {
    'value'   : '4',
    'display' : 'Clean Up'
}];
x
No
integer
0

x coordinate value for top left corner.

y
No
integer
0

y coordinate value for top left corner.

width
No
integer
150

Width in pixels.

height
No
integer
Text.LINE_HEIGHT

Height in pixels.

circular
No
boolean
false

Options loop in circles. Whether or not the control should go back to the first option when the last is reached and next is pressed or when the first option is visible and previous is pressed if it should go to the end. 

prevText
No
string
Prev

Text to display on the button that takes you to the previous option.

nextText
No
string
Next

Text to display on the button that takes you to the next option.

initialValue
No
string
 

Intiial value to set the object to. If this is not provided the value defaults to the first item in the options array. The value must match the value property of one of the options.

 

 

Icon

This extended class is not a child of base widget, so it cannot be added directly to the screen. Access the textWidget property to add or remove it from the screen. This extended class requires the  'app' library , and it must be initialized with an init function. 

 

Methods

Name Description 
setValue

Sets the value of the object to one of the possible options

takeFocus

Gives the selected widget keyboard focus. Calling this method triggers the object's onFocus handler to be called, which must return true to take focus.

 

Properties

Name Description 
textWidget

TextCycler is not a child of the base Widget so it cannot be added directly to the screen. Access the textWidget property to add or remove it from the screen. (e.g., window.add(tc.textWidget) )

Basic Example:

value

Gets the value of the currently selected option.

Basic Example:

  • No labels