Represents user interface event. Events and correspndent event handlers are defined in Events.
Event.GESTURE_FLAG_ZOOM
- two fingers zoom;Event.GESTURE_FLAG_ROTATE
- two fingers rotate;Event.GESTURE_FLAG_PAN_VERTICAL
- vertical swipe or panning;Event.GESTURE_FLAG_PAN_HORIZONTAL
- horizontal swipe or panning;Event.GESTURE_FLAG_TAP1
- press-and-tap gesture;Event.GESTURE_FLAG_TAP2
- tap by two fingers;Event.GESTURE_FLAG_PAN_WITH_GUTTER
- PAN_VERTICAL and PAN_HORIZONTAL modifier - gutter.Event.GESTURE_FLAG_PAN_WITH_INERTIA
- PAN_VERTICAL and PAN_HORIZONTAL modifier - generate inertia events.Event.GESTURE_FLAGS_ALL
- all flags/eventsEvent.deltaV
field contains float > 1.0 in case of zoom-out and float < 1.0 for zoom-in.Event.deltaX
and Event.deltaY
fields contain integers - number of pixels in X and Y directions.Event.deltaV
field contains delta angle (in radians).Event.flags in all events (but not in GESTURE_REQUEST) is ORed combination of the following states:
Event.GESTURE_STATE_BEGIN
- is "on" for first event in the gesture sequence.Event.GESTURE_STATE_INERTIA
- is "on" for events synthesized by the inertia processor.Event.GESTURE_STATE_END
- is "on" for last event in the gesture sequence.evt.target
is a top element that have got e.g. right mous click. evt.source
[read/write] is a menu element that is about to popup. You can set your own menu element to the evt.source field while handling this event.evt.source
is the menu element that you can modify at this point.display
or visibility
CSS attributes. The event is sent only to the element itself (so not a bubbling event).<html>
) of the document that is complete. Note that the event is being generated even if some of resources were not available. DOM elements that contain non-available resources will get :incomplete
state flag.evt.data
field contains data to be sent to the server as a map (object). You can modify the data or discard submission by returning true
("event consumed") from the event handler.evt.data
field contains data to be set to input fields.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. }
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. }
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; }
#text
- plain text;#html
- html;#url
- hyperlink;#file
- file list;#json
- JSON data (sciter specific);Returns true if the event has symbolic name of eventName and its target matches the selector. The eventName can accept following symbolic names:
Retuns list of data items types associated with exchange oeration. The list is an array containing #text
, #html
, #url
, #file
, #picture
or #json
.
The method allows to get data of particular data type:
#text
- returns string - dragged text;
#html
- returns (url,html) pair - url of dragged HTML fragment and the HTML itself;
#url
- returns (caption,url) pair - caption and the url itself;
#file
- returns filenames array - list of dragged file paths;
#picture
- returns Image object if dragged data contains an image;
#json
- returns value - json value.
Class (static) function, reports true if key is pressed. Can be used to check state of for example CAPSLOCK or NUMLOCK keys :
if( Event.keyPressed(Event.VK_CAPITAL) ) ... CAPSLOCK is pressed ...
Symbolic event names are used by Element.subscribe("name", ...)
, Element.on("name", ...)
, Event.match("name", ...)
and event name () {}
script functions.
<input>
is about to change, the event gets sent before actual changes applied.event.cancel = true;
in event handler.drag***
events, a.k.a. Event.X_WILL_ACCEPT_DROP
. "Will the element accept the event.dragging
data?". The element shall return true
from the handler in order to receive all other drag/drop events.Any other string is considered as custom event, to post/send such events use Element.postEvent
/sendEvent(name,...)
methods.