Clear Up
SharpKit Reference

EventObject Class

Just as Ext.Element wraps around a native DOM node, Ext.EventObject wraps the browser's native event-object normalizing cross-browser differences, such as which mouse button is clicked, keys pressed, mechanisms to stop event-propagation along with a method to prevent default actions from taking place.

For example:

  
function handleClick(e, t){ // e is not a standard event object, it is a Ext.EventObject
            e.preventDefault();
            var target = e.getTarget(); // same as t (the target HTMLElement)
            ...
            }
            var myDiv = Ext.get("myDiv");  // get reference to an Ext.Element
            myDiv.on(         // 'on' is shorthand for addListener
            "click",      // perform an action on click of myDiv
            handleClick   // reference to the action handler
            );
            // other methods to do the same:
            Ext.EventManager.on("myDiv", 'click', handleClick);
            Ext.EventManager.addListener("myDiv", 'click', handleClick);
            

Namespace: Ext

Base Types

Properties

Name Description
A Key constant Defaults to: 65
ALT Key constant Defaults to: 18
altKey True if the alt key was down during the event.
B Key constant Defaults to: 66
BACKSPACE Key constant Defaults to: 8
C Key constant Defaults to: 67
CAPS_LOCK Key constant Defaults to: 20
CONTEXT_MENU Key constant Defaults to: 93
CTRL Key constant Defaults to: 17
ctrlKey True if the control key was down during the event. In Mac this will also be true when meta key was down.
D Key constant Defaults to: 68
DELETE Key constant Defaults to: 46
DOWN Key constant Defaults to: 40
E Key constant Defaults to: 69
EIGHT Key constant Defaults to: 56
END Key constant Defaults to: 35
ENTER Key constant Defaults to: 13
ESC Key constant Defaults to: 27
F Key constant Defaults to: 70
F1 Key constant Defaults to: 112
F10 Key constant Defaults to: 121
F11 Key constant Defaults to: 122
F12 Key constant Defaults to: 123
F2 Key constant Defaults to: 113
F3 Key constant Defaults to: 114
F4 Key constant Defaults to: 115
F5 Key constant Defaults to: 116
F6 Key constant Defaults to: 117
F7 Key constant Defaults to: 118
F8 Key constant Defaults to: 119
F9 Key constant Defaults to: 120
FIVE Key constant Defaults to: 53
FOUR Key constant Defaults to: 52
G Key constant Defaults to: 71
H Key constant Defaults to: 72
HOME Key constant Defaults to: 36
I Key constant Defaults to: 73
INSERT Key constant Defaults to: 45
J Key constant Defaults to: 74
K Key constant Defaults to: 75
L Key constant Defaults to: 76
LEFT Key constant Defaults to: 37
M Key constant Defaults to: 77
N Key constant Defaults to: 78
NINE Key constant Defaults to: 57
NUM_CENTER Key constant Defaults to: 12
NUM_DIVISION Key constant Defaults to: 111
NUM_EIGHT Key constant Defaults to: 104
NUM_FIVE Key constant Defaults to: 101
NUM_FOUR Key constant Defaults to: 100
NUM_MINUS Key constant Defaults to: 109
NUM_MULTIPLY Key constant Defaults to: 106
NUM_NINE Key constant Defaults to: 105
NUM_ONE Key constant Defaults to: 97
NUM_PERIOD Key constant Defaults to: 110
NUM_PLUS Key constant Defaults to: 107
NUM_SEVEN Key constant Defaults to: 103
NUM_SIX Key constant Defaults to: 102
NUM_THREE Key constant Defaults to: 99
NUM_TWO Key constant Defaults to: 98
NUM_ZERO Key constant Defaults to: 96
O Key constant Defaults to: 79
ONE Key constant Defaults to: 49
P Key constant Defaults to: 80
PAGE_DOWN Key constant Defaults to: 34
PAGE_UP Key constant Defaults to: 33
PAUSE Key constant Defaults to: 19
PRINT_SCREEN Key constant Defaults to: 44
Q Key constant Defaults to: 81
R Key constant Defaults to: 82
RETURN Key constant Defaults to: 13
RIGHT Key constant Defaults to: 39
S Key constant Defaults to: 83
SEVEN Key constant Defaults to: 55
SHIFT Key constant Defaults to: 16
shiftKey True if the shift key was down during the event.
SIX Key constant Defaults to: 54
SPACE Key constant Defaults to: 32
T Key constant Defaults to: 84
TAB Key constant Defaults to: 9
THREE Key constant Defaults to: 51
TWO Key constant Defaults to: 50
U Key constant Defaults to: 85
UP Key constant Defaults to: 38
V Key constant Defaults to: 86
W Key constant Defaults to: 87
WHEEL_SCALE The mouse wheel delta scaling factor. This value depends on browser version and OS and attempts to produce a similar scrolling experience across all platforms and browsers. To change this value:
Ext.EventObjectImpl.prototype.WHEEL_SCALE = 72;
            
X Key constant Defaults to: 88
Y Key constant Defaults to: 89
Z Key constant Defaults to: 90
ZERO Key constant Defaults to: 48

Methods

Name Description
correctWheelDelta(JsNumber) Correctly scales a given wheel delta.
getCharCode() Gets the character code for the event.
getKey() Returns a normalized keyCode for the event.
getPageX() Gets the x coordinate of the event.

This method has been deprecated since 4.0

Replaced by getX

getPageY() Gets the y coordinate of the event.

This method has been deprecated since 4.0

Replaced by getY

getPoint() Returns a point object that consists of the object coordinates.
getRelatedTarget(object, object, object) Gets the related target.
getTarget(object, object, object) Gets the target for the event.
getWheelDelta() Normalizes mouse wheel y-delta across browsers. To get x-delta information, use getWheelDeltas instead.
getWheelDeltas() Returns the mouse wheel deltas for this event.
getX() Gets the x coordinate of the event.
getXY() Gets the page coordinates of the event.
getY() Gets the y coordinate of the event.
hasModifier() Returns true if the control, meta, shift or alt key was pressed during this event.
injectEvent(object) Injects a DOM event using the data in this object and (optionally) a new target. This is a low-level technique and not likely to be used by application code. The currently supported event types are: HTMLEvents
  • load
  • unload
  • select
  • change
  • submit
  • reset
  • resize
  • scroll
  • MouseEvents
  • click
  • dblclick
  • mousedown
  • mouseup
  • mouseover
  • mousemove
  • mouseout
  • UIEvents
  • focusin
  • focusout
  • activate
  • focus
  • blur
  • isNavKeyPress() Checks if the key pressed was a "navigation" key
    isSpecialKey() Checks if the key pressed was a "special" key
    preventDefault() Prevents the browsers default handling of the event.
    stopEvent() Stop the event (preventDefault and stopPropagation)
    stopPropagation() Cancels bubbling of the event.
    within(object, object, object)
    © Copyright 2005-2011 SharpKit. All rights reserved.