Phone API Reference - UI Classes (Widgets) - Widget (Base Class) - takeFocus

Phone API Reference - UI Classes (Widgets) - Widget (Base Class) - takeFocus

takeFocus

Description

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.

Basic Example: 

 exampleObject.takeFocus();

Parameters

None

Examples

create a text object and give it keyboard focus

// the instantiation of the Text object could be replaced by any other Widget. var textObject = new Text(0, 0, 100, 100, 'Test text for the widget.'); textObject.onFocus = function () {     return true; }; textObject.takeFocus();