homesciterEvents

Events in the Sciter.

DOM element events.

handler function name event.type field Comment
Events that are being traversed through DOM elements in Sinking/Bubbling fashion:
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.
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.
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.
view.onUnload()
: true | false
This event is raised before the view will get a new document. E.g. view.load() will cause this method be invoked. Return false from this method to reject unloading of the current document. Code of this method is the best place to close all opened resources like storages, etc.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Sciter

Documentation

Classes and objects
Download