homesciterEvent

Event object

Represents user interface event. Events and correspndent event handlers are defined in Events.

Constants

Event Group codes (used with Element.subscribe() method)

MOUSE mouse events group
KEY key events group
FOCUS focus events group
BEHAVIOR_EVENT group of events generated (synthesized) by particular behaviors (like BUTTON_CLICK, EDIT_VALUE_CHANGING, etc.)
SCROLL scroll events group
SIZE size events group (that is just single event, onSize)

Mouse event codes

MOUSE_ENTER type of event, mouse enters the element.
MOUSE_LEAVE type of event, mouse leaves the element.
MOUSE_MOVE type of event, mouse moves over the element.
MOUSE_DOWN type of event, mouse button pressed in the element.
MOUSE_UP type of event, mouse button released in the element.
MOUSE_DCLICK type of event, mouse clicked twice in the element.
MOUSE_WHEEL type of event, mouse wheel rotated.
MOUSE_TICK type of event, mouse timer event. Runtime sends this event regularly when mouse button is pressed on the element.
MOUSE_IDLE type of event, mouse timer event. Runtime sends this event when mouse is over the element, not pressed and not moving for some time. By default this event triggers popup of tooltip.

Keyboard event codes

KEY_DOWN type of event, key pressed when element or one of its children is in focus.
KEY_UP type of event, key released when element or one of its children is in focus.
KEY_CHAR type of event, character key pressed when element or one of its children is in focus.

Scroll event codes

SCROLL_HOME
SCROLL_END
SCROLL_STEP_PLUS
SCROLL_STEP_MINUS
SCROLL_PAGE_PLUS
SCROLL_PAGE_MINUS
SCROLL_POS

Focus event codes

LOST_FOCUS
GOT_FOCUS

Logical event codes from builtin behaviors

BUTTON_CLICK
BUTTON_PRESS
BUTTON_STATE_CHANGED Checkbox/radio state was changed. ( Not all BUTTON_CLICKs are changing state of those. )
EDIT_VALUE_CHANGING
EDIT_VALUE_CHANGED
SELECT_SELECTION_CHANGED
SELECT_STATE_CHANGED
HYPERLINK_CLICK
ACTIVATE_CHILD
POPUP_REQUEST
POPUP_READY
POPUP_DISMISSED
MENU_ITEM_ACTIVE Mouse over the menu item, Event.target is a menu item, Event.owner - initiator of the menu  
MENU_ITEM_CLICK Click on the menu item, Event.target is a menu item, Event.owner - initiator of the menu
DRAGGING_MOVE
DRAGGING_COPY
Values of the draggingMode attribute below.
REQUEST_TOOLTIP
Request for tooltip, the event is sent in respnse of MOUSE_IDLE. Element on evt.source is a proposed tooltip element. You can assign your own DOM element to the evt.source field.

Event flags

SINKING
Event dispatching direction. If this flag set then event is being dispatched in the direction from parent to child. Example:
switch(evt.type)
{
   case Event.MOUSE_DOWN | Event.SINKING:
        // handle thr event before any child
   case Event.MOUSE_DOWN:
        // it is here as no one child processed it.
}
HANDLED
Event was handled (event handler function returned true) by some child of the element or behavior. Example:
switch(evt.type)
{
   case Event.MOUSE_DOWN:
       // after all children and no one has handled it.
   case Event.MOUSE_DOWN | Event.HANDLED:
       // after all children, and some child has handled it.
}

Virtual key codes - values of keyCode filed in KEY_DOWN and KEY_UP events

VK_CANCEL   VK_BACK     VK_TAB      VK_CLEAR    VK_RETURN   VK_SHIFT    VK_CONTROL
VK_MENU     VK_PAUSE    VK_CAPITAL  VK_KANA     VK_HANGUL   VK_JUNJA    VK_FINAL
VK_HANJA    VK_KANJI    VK_ESCAPE   VK_CONVERT  VK_SPACE    VK_PRIOR    VK_NEXT
VK_END      VK_HOME     VK_LEFT     VK_UP       VK_RIGHT    VK_DOWN     VK_SELECT
VK_PRINT    VK_EXECUTE  VK_SNAPSHOT VK_INSERT   VK_DELETE   VK_HELP     VK_SLEEP
VK_NUMPAD0  VK_NUMPAD1  VK_NUMPAD2  VK_NUMPAD3  VK_NUMPAD4  VK_NUMPAD5  VK_NUMPAD6
VK_NUMPAD7  VK_NUMPAD8  VK_NUMPAD9  VK_MULTIPLY VK_ADD      VK_SEPARATOR VK_SUBTRACT
VK_DECIMAL  VK_DIVIDE   VK_F1       VK_F2       VK_F3       VK_F4       VK_F5
VK_F6       VK_F7       VK_F8       VK_F9       VK_F10      VK_F11      VK_F12
VK_F13      VK_F14      VK_F15      VK_F16      VK_F17      VK_F18      VK_F19
VK_F20      VK_F21      VK_F22      VK_F23      VK_F24

Example:

switch(event.keyCode)
{
  case Event.VK_HOME: index = 0; break;
  case Event.VK_END: index = this.length - 1; break;
}

Properties

type r - Integer, type of the event, value equal to one of the constant above.
altKey r - true/false, true if ALT key pressed. Valid for Mouse, Key events.
ctrlKey r - true/false, true if CTRL key pressed. Valid for Mouse, Key events.
shiftKey r - true/false, true if SHIFT key pressed. Valid for Mouse, Key events.
mainButton r - true/false, true if main mouse button pressed (usually left mouse button). Valid for Mouse events.
propButton r - true/false, true if property mouse button pressed (usually right mouse button). Valid for Mouse events.
target r - Element,  element this event tageted to.
reason r/w - integer, reason field of control event code.
keyCode r - integer, key scan code for KEY_DOWN/KEY_UP events and unicode codepoint of the character pressed for the KEY_CHAR event.
group r - symbol, event group symbol, here it is a symbol of event handler function: #onMouse, #onKey, #onFocus, etc.
wheelDelta r - mouse wheel "tick" - valid in onMouse/MOUSE_WHEEL event.
scrollPos r - scroll position in SCROLL_POS event.
x r - integer, x coordinate of the mouse event relative to the element itself (origin of its content box)
y r - integer, y coordinate of the mouse event relative to the element itself (origin of its content box)
xRoot r - integer, x coordinate of the mouse event relative to the element's root element (<html>). As root element spans the whole view area then it is also view relative coordinate.
yRoot r -integer, y coordinate of the mouse event relative to the element's root element (<html>).
xScreen r - integer, x coordinate of the mouse event relative to the screen.
yScreen r -integer, y coordinate of the mouse event relative to the screen.
owner rw - Element, owner (initiator) of the menu in MENU_ITEM_CLICK, also this is value of last parameter in Element.sendEvent method.
isOnIcon r - true | false, onMouse(evt) only. true if mouse is on icon area. Element icon is foreground, no-repeat image.
dragging r/w - Element, onMouse(evt) and onExchange(evt) only. Reference of element being dragged when onMouse and data being dragged when onExchange().
draggingMode r/w - integer, onMouse(evt) only. Dragging mode - either Event.DRAGGING_MOVE or Event.DRAGGING_COPY - current dragging mode.
draggingDataType r - symbol,  onExchange(evt) only. One of the following values:
  • #text -
  • #html
  • #url
  • #file
  • #json

Sciter

Documentation

Classes and objects
Download