Class YAHOO.util.KeyListener
KeyListener is a utility that provides an easy interface for listening for keydown/keyup events fired against DOM elements.
Public Properties
|
KEYDOWN<static> : String |
KeyListener |
<static> Constant representing the DOM "keydown" event. |
|
KEYUP<static> : String |
KeyListener |
<static> Constant representing the DOM "keyup" event. |
|
enabled : Boolean |
KeyListener |
Boolean indicating the enabled/disabled state of the Tooltip |
Public Methods
|
KeyListener(HTMLElement attachTo , String attachTo , Object keyData , Function handler , Object handler , String event ) |
KeyListener |
|
|
disable() : void |
KeyListener |
Disables the KeyListener by removing the DOM event listeners from the target DOM element |
|
enable() : void |
KeyListener |
Enables the KeyListener by attaching the DOM event listeners to the target DOM element |
|
toString() : String |
KeyListener |
Returns a String representation of the object. |
Public Events
|
disabledEvent : (Object keyData ) |
KeyListener |
The CustomEvent fired when the KeyListener is disabled via the disable() function |
|
enabledEvent : (Object keyData ) |
KeyListener |
The CustomEvent fired when the KeyListener is enabled via the enable() function |
Property Details
KEYDOWN<static>
public String KEYDOWN<static>
<static> Constant representing the DOM "keydown" event.
This property is defined by KeyListener.
KEYUP<static>
public String KEYUP<static>
<static> Constant representing the DOM "keyup" event.
This property is defined by KeyListener.
enabled
public Boolean enabled
Boolean indicating the enabled/disabled state of the Tooltip
This property is defined by KeyListener.
Constructor Details
KeyListener
public function KeyListener(HTMLElement attachTo
, String attachTo
, Object keyData
, Function handler
, Object handler
, String event
)
Parameters:
attachTo
: HTMLElementThe element or element ID to which the key event should be attached
attachTo
: StringThe element or element ID to which the key event should be attached
keyData
: ObjectThe object literal representing the key(s) to detect. Possible attributes are shift(boolean), alt(boolean), ctrl(boolean) and keys(either an int or an array of ints representing keycodes).
handler
: FunctionThe CustomEvent handler to fire when the key event is detected
handler
: ObjectAn object literal representing the handler.
event
: StringOptional. The event (keydown or keyup) to listen for. Defaults automatically to keydown.
Method Details
disable
public function disable()
Disables the KeyListener by removing the DOM event listeners from the target DOM element
This method is defined by KeyListener.
enable
public function enable()
Enables the KeyListener by attaching the DOM event listeners to the target DOM element
This method is defined by KeyListener.
toString
public function toString()
Returns a String representation of the object.
This method is defined by KeyListener.
Event Details
disabledEvent
public event disabledEvent
The CustomEvent fired when the KeyListener is disabled via the disable() function
Subscribers will be called with the following parameters:
This event is defined by KeyListener.
enabledEvent
public event enabledEvent
The CustomEvent fired when the KeyListener is enabled via the enable() function
Subscribers will be called with the following parameters:
This event is defined by KeyListener.
yui-ext - Copyright © 2006 Jack Slocum. |
Yahoo! UI - Copyright © 2006 Yahoo! Inc.
All rights reserved.