CAPH.WUI.WIDGET.KEYCONTROL
KeyControl represents a navigating function for the moving of highlight, highlightHelper can automatically find the most nearest widget on the up, down, left and right directions, this widget using the singleton pattern, users do not need to use the 'new' operator.
Methods
bindListener | ||
Description | ||
Binds the listener for KeyControl. User can bind function to the event. The function will be called, when the event is fired. | ||
Parameters | ■type - String - Event type, such as 'focuschange', 'keydown', 'mouseover' and so on. ■handler - Function - Callback function for the user. The function will be called, when the event is fired. This function is used for customized demand. For example, user can replace the next widget witch find by keyControl automatically. | |
Return | ■Void | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var keyControl = caph.wui.widget.KeyControl; keyControl.bindListener('focuschange', function(from, to, evname) { var result = {}; if(!from && to.id == 'gator0' ) { result.focus = gator.getItems().get(3)[0].getDomEl(); return result; } }); |
removeListener | ||
Description | ||
Removes the listener for KeyControl. The type of event of function that user binds will be removed. | ||
Parameters | ■type - String - Event type, such as 'focuschange', 'keydown' ■handler - Function - Callback function for the user | |
Return | ■Void | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var keyControl = caph.wui.widget.KeyControl; keyControl.removeListener('focuschange', function(from, to, evname) { var result = {}; if(!from && to.id == 'gator0' ) { result.focus = gator.getItems().get(3)[0].getDomEl(); return result; } }); |
init | ||
Description | ||
The initialization for KeyControl. | ||
Parameters | ■option (Optional) - object - The option includes focusedCls(the class style of highlight effect, default value is caph-highlighted) and navCls(the class style of navigate item, default value is caph-nav-item), if the option isn't set, it will get default values. e.g. {focusedCls: 'caph-highlighted', navCls: 'caph-nav-item'}. | |
Return | ■Void | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var keyControl = caph.wui.widget.KeyControl; keyControl.init(); |