Phone API Reference - UI Extended Classes - TextCycler
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:Â
var app = require('app');
app.init(); //app must be required and initialized somewhere before creating TextCyclers
 Â
require('TextCycler').TextCycler; |
Class Constructor
new TextCycler
Creates a new TextCycler object.
 var cyclerObj = new TextCycler(parameters); |
Initialization Parameters
Name | Required | Type | Default | Description |
---|---|---|---|---|
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. |
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
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: |
Â