Phone API Reference - UI Extended Classes - SelectInput

SelectInput

 

Combines a variety of core objects to create a simple control that is analgous to a web browser's select input (dropdown). Allows the user to open a new screen and scroll through a list of options. Recommended for large lists.

Require Extended Library: 

var app = require('app'); app.init(); //app must be required and initialized somewhere before creating SelectInputs    require('SelectInput').SelectInput;

Class Constructor

new SelectInput()

Creates a new SelectInput object.

var selectObj = new SelectInput(parameters); 

Initialization Parameters

Name

Required

Type

Default

Description

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.

title

No

string

Choose an Option

Title text to display.

showXKey

No

boolean

true

Whether or not to show the 'x' cancel softkey

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

Name 

Description 

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 

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:

 

Return to Documentation Home I Return to Sangoma Support