\CJAX\EventKeyEvent

The KeyEvent class, representing events that describes user interaction with the keyboard.

KeyEvent inherits from InputEvents, therefore it contains all properties for input event too.

Summary

Methods
Properties
Constants
__construct()
isAltDown()
getComponent()
isControlDown()
isMetaDown()
isShiftDown()
getLocation()
canBubble()
isCancelable()
hasDefaultPrevented()
getPhase()
getSource()
getTarget()
getTimeStamp()
isTrusted()
getType()
__toString()
getCharCode()
getKeyCode()
getKeyText()
No public properties found
CAPTURING_PHASE
AT_TARGET
BUBBLING_PHASE
No protected methods found
$altKey
$component
$ctrlKey
$metaKey
$shiftKey
$bubbles
$cancelable
$defaultPrevented
$phase
$source
$target
$timeStamp
$trusted
$type
$charCode
$keyCode
$keyText
$location
N/A
No private methods found
No private properties found
N/A

Constants

CAPTURING_PHASE

CAPTURING_PHASE

The CAPTURING_PHASE constant, defines the integer value for capturing phase event status.

AT_TARGET

AT_TARGET

The AT_TARGET constant, defines the integer value for at-target phase event status.

BUBBLING_PHASE

BUBBLING_PHASE

The BUBBLING_PHASE constant, defines the integer value for bubbling phase event status.

Properties

$altKey

$altKey : boolean

The altKey property, checks if the "ALT" key was pressed when input event is was triggered.

Type

boolean

$component

$component : string

The component property, stores the component id involved in this input event.

Type

string

$ctrlKey

$ctrlKey : boolean

The ctrlKey property, checks if the "CTRL" key was pressed when input event is was triggered.

Type

boolean

$metaKey

$metaKey : boolean

The metaKey property, checks if the "META" key was pressed when input event is was triggered.

Type

boolean

$shiftKey

$shiftKey : boolean

The shiftKey property, checks if the "SHIFT" key was pressed when input event is was triggered.

Type

boolean

$bubbles

$bubbles : boolean

The bubbles property, specifies if a specific event can bubble or not.

Type

boolean

$cancelable

$cancelable : boolean

The cancelable property, specifies if a if a specific event is cancelable.

Type

boolean

$defaultPrevented

$defaultPrevented : boolean

The defaultPrevented property, checks if default is prevented.

Type

boolean

$phase

$phase : integer

The phase property, defines the event phase.

Type

integer

$source

$source : string

The source property, stores the id of element that triggers the event.

Type

string

$target

$target : string

The target property, stores the id of element whose event listener triggers this event.

Type

string

$timeStamp

$timeStamp : integer

The timeStamp property, specifies the number of milliseconds since midnight of January 1, 1970.

Type

integer

$trusted

$trusted : boolean

The trusted property, checks if the event is trusted or not.

Type

boolean

$type

$type : string

The target property, defines the type of event that was triggered.

Type

string

$charCode

$charCode : integer

The charCode property, stores the Unicode value of the pressed keyboard key.

Type

integer

$keyCode

$keyCode : integer

The keyCode property, stores the Unicode value of the pressed keyboard key.

Type

integer

$keyText

$keyText : string

The keyText property, defines the keyboard button that was pressed when a key event occured.

Type

string

$location

$location : integer

The location property, specifies the location of a key on the keyboard or device.

Type

integer

Methods

__construct()

__construct(\StdClass  $event) : \CJAX\Event\KeyEvent

The constructor for KeyEvent class, it initializes basic key event properties.

Child classes of InputEvent need to call this parent constructor to ensure complete initialization of event object.

Parameters

\StdClass $event

Returns

\CJAX\Event\KeyEvent

isAltDown()

isAltDown() : boolean

The isAltDown method, returns whether or not the Alt modifier is down on this event.

Returns

boolean

getComponent()

getComponent() 

The getComponent method, obtains the component id associated with this input event.

isControlDown()

isControlDown() : boolean

The isControlDown method, returns whether or not the Control modifier is down on this event.

Returns

boolean

isMetaDown()

isMetaDown() : boolean

The isMetaDown method, returns whether or not the Meta modifier is down on this event.

Returns

boolean

isShiftDown()

isShiftDown() : boolean

The isShiftDown method, returns whether or not the Shift modifier is down on this event.

Returns

boolean

getLocation()

getLocation() : integer

The getLocation method, obtains the location of the key that originated this key event.

This method will need to be overriden by child classes to provide different implementations.

Returns

integer

canBubble()

canBubble() : boolean

The canBubble method, find out if a specific event can bubble or not.

Returns

boolean

isCancelable()

isCancelable() : boolean

The isCancelable method, find out if a specific event is cancelable.

Returns

boolean

hasDefaultPrevented()

hasDefaultPrevented() : boolean

The hasDefaultPrevented method, checks whether the preventDefault() method was called for the event.

Returns

boolean

getPhase()

getPhase() : integer

The getPhase method, returns a number that indicates which phase of the event flow is currently being evaluated.

Returns

integer

getSource()

getSource() : string

The getSource method, returns the element that triggered the event.

Returns

string

getTarget()

getTarget() : string

The getTarget method, returns the element whose event listeners triggered the event.

Returns

string

getTimeStamp()

getTimeStamp() : integer

The getTimeStamp method, gets the number of milliseconds since midnight of January 1, 1970.

Returns

integer

isTrusted()

isTrusted() : boolean

The isTrusted method, find out if a specific event is trusted.

Returns

boolean

getType()

getType() : string

The isTrusted method, return the type of event that was triggered.

Returns

string

__toString()

__toString() : string

Magic method __toString, acquires the event's information in string format.

Returns

string

getCharCode()

getCharCode() : integer

The getCharCode method, gets the Unicode value of the pressed keyboard key.

Returns

integer

getKeyCode()

getKeyCode() : integer

The getKeyCode method, returns the integer keyCode associated with the key in this event.

Returns

integer

getKeyText()

getKeyText() : string

The getKeyText method, obtains the character associated with the key in this event.

Returns

string