Events in the Sciter.

Events in the Sciter.

DOM element events.

handler function name
event.type field
Comment
Sinking/Bubbling Events:

onMouse(event) : true|false

MOUSE_ENTER
Mouse/Pointer enters the element.
MOUSE_LEAVE
Mouse/Pointer leaves the element.
MOUSE_MOVE
Mouse/Pointer moves over the element.
MOUSE_DOWN
One of mouse buttons pressed in the element. event.mainButton and event.propButton will tell what button was pressed.
MOUSE_UP
One of mouse buttons released in the element. event.mainButton and event.propButton will tell what button was pressed. To detect single MOUSE CLICK event use following condition:
event.type == Event.MOUSE_UP &&
this.getState(Element.STATE_PRESSED)
MOUSE_DCLICK
Double mouse click in the element.
MOUSE_WHEEL
Mouse wheel rotation. event.wheelDelta is a number of wheel ticks made.
MOUSE_TICK
Repeatable event that is generated when one of mouse button pressed.
MOUSE_IDLE
Pulsed event, is generated when mouse is not moving some short period of time. If it is not handled in the code then it is used by the engine to popup tooltip for the element.

onKey(event) : true|false

KEY_DOWN
Keyboard key pressed. event.keyCode is virtual key code of the key.
KEY_UP
Keyboard key released. event.keyCode is virtual key code of the key.
KEY_CHAR
Character key pressed. event.keyCode is a value of UNICODE codepoint.

onFocus(event) : true|false

GOT_FOCUS
Focusable element got input focus.
LOST_FOCUS
Elements lost input focus.

onExchange(event) : true|false

System shell drag and drop events
X_DRAG_ENTER
System dragging pointer (cursor) enters the element.

In this events following attributes of the Event object are used:
  • evt.dragging – data being dragged: string | object
  • evt.draggingDataType#text | #html | #url | #file | #json
  • evt.draggingMode#move | #copy | #link
  • evt.x and evt.y – report position of the mouse cursor.

X_DRAG_LEAVE
System dragging pointer (cursor) leaves the element.
X_DRAG
System dragging pointer is moving over the the element.
X_DROP
User releases mouse – drops data into the element.

onControlEvent(event):true|false
Synthetic (logical) events

BUTTON_CLICK
Click on button, generated by behaviors: button, checkbox, radio.
BUTTON_PRESS
Mouse/Key pressed in button, generated by behaviors: button, checkbox, radio.
BUTTON_STATE_CHANGED
State (value) of button was changed, generated by behaviors: checkbox, radio.
EDIT_VALUE_CHANGING
Value of editbox is about to be changed, generated by behaviors: edit, number, decimal, date, masked. element.value reflects old value.
EDIT_VALUE_CHANGED
Value of editbox was just changed, generated by behaviors: edit, number, decimal, date, masked. element.value reflects new value.
SELECT_SELECTION_CHANGED
Selection was changed in elements-selectors. generated by behaviors: select, dropdown-select, calendar.
SELECT_STATE_CHANGED
State of item was changed in elements-selectors. generated by behaviors: select when some of the <options> are expanded/collapsed, event.target is the item that changed its state. behavior: calendar sends this event after calendar was switched to show another month so by handling this event you can update DOM inside the calendar.
HYPERLINK_CLICK
Click on hyperlink. event.target is that hyperlink element.
ACTIVATE_CHILD
Request to container to activate child. accesskey processor post this message if accesskey is defined for the element but element is passive, e.g. tab on Tabs control. See: extenders.js / type Tabs.
POPUP_REQUEST

Secret stuff.

POPUP_READY
POPUP_DISMISSED
MENU_ITEM_ACTIVE
Happens when menu item is highlighted.
MENU_ITEM_CLICK
Click on menu item. event.target is the item event.owner is an owner of the popup menu.
ELEMENT_COLLAPSED

These two events are sent by behavior:expandable-list to notify about closed/open sections of expandable lists.

ELEMENT_EXPANDED
FORM_SUBMIT
behavior:form is about to submit values.
FORM_RESET
behavior:form is about to reset inputs.
DOCUMENT_COMPLETE
document is complete notification – all resources requested by the document are delivered at this point.
HISTORY_NEXT
Request to behavior:history to navigate to next document in browsing history.
HISTORY_PRIOR
Request to behavior:history to navigate to previous document in browsing history.
HISTORY_STATE_CHANGED
Notification posted by behavior:history after executing navigation.
range 0x1000 .. 0x7FFF
Custom control events. Any code from this range can be used in element.sendEvent(code,…) calls. If behavior class is designed to behave like for example a button then you may use element.postEvent(Event.BUTTON_CLICK,…) to notify all parties about clicks.
Non-bubbling events

onScroll(event) : true|false

SCROLL_HOME

Requests to scroll, typically are coming from <input type=vscrollbar> or <input type=hscrollbar>.
In case of SCROLL_POS use event.scrollPos field to get requested position to scroll.

SCROLL_END
SCROLL_STEP_PLUS
SCROLL_STEP_MINUS
SCROLL_PAGE_PLUS
SCROLL_PAGE_MINUS
SCROLL_POS
attached() : void
Method of behavior class (type). If defined in the type definition then it will be invoked by the engine when DOM element will be subclassed by this class. Variable this inside this function is a reference to the DOM element this behavior was just attached to. Consider attached() as an equivalent of constructor function for other classes.
onTimer() : true|false
Timer tick. To start timer on the element use element.timer(milliseconds) call. Return false from this method to stop the timer.
onSize() : void
Size of the element was changed. To get dimensions use this.box() function.

View events

view.onSize() : void
This function is invoked by the engine after dimensions of the view (window) was changed. Use view.box() method to get dimensions.
view.onMove() : void
Invoked by the engine after position of the view (window) was changed. Use view.box() method to get dimensions and positions.
view.onStateChanged():void
Invoked when state of the view (window) was changed. See View.state property.