Engine for Web Applications

org.cote.js.dom.event

static org.cote.js.dom.event

version 1.9.18

Utilities for DOM Events.

See Using event utilities for an example of implementating the script on a page. This class participates in the engine library.

Index

Example Index

Property Index

Method Index

Examples

Using event utilities

This example shows how to use the event buffer and createHandler mechanisms to preserve the event handler context to a specific object instance.

Example Code

<p id = "oPara">Test paragraph</p>
<script type = "text/javascript">
var oObject = org.cote.js.newObject("DemoType","1.0",true);
// Add the createHandler method for this object with addEventBuffer
org.cote.js.dom.event.addEventBuffer(oObject);
// Create an event handler wrapper with createHandler for an onclick event.
// Specify the event name and the bit to use the ObjectRegistry.
// This creates oObject._prehandle_click which will invoke oObject._handle_click.
oObject.createHandler("click",0,0,1);
oObject._handle_click = function(e){
   var oEvent = org.cote.js.dom.event._gevt(e);
   var oSource = org.cote.js.dom.event._gevt_src(e);
   // The 'this' object refers to the instance of oObject
};
 // Add the onclick event to the paragraph element, oPara
var oPara = document.getElementById("oPara");
// Use the _prehandle_click created by the createHandler method.
org.cote.js.dom.event.addEventListener(oPara, "click", oObject._prehandle_click);
</script>

Properties

object_version

The version of the object

Syntax

String = org.cote.js.dom.event.object_version

Methods

_gevt

Returns the event object, where the specified parameter may or may not be the event object depending on the browser. Method is private and should not be directly referenced.

Syntax

e = _gevt( o )

Parameters

Returns

e as object: The event object.

_gevt

Returns the event destination or target object. Method is private and should not be directly referenced.

Syntax

e = _gevt( o )

Parameters

Returns

e as object: The event destination object.

_gevt_cancel

Cancels the event. Method is private and should not be directly referenced.

Syntax

void _gevt_cancel( o )

Parameters

_gevt_org

Returns the event origination object. Method is private and should not be directly referenced.

Syntax

e = _gevt_org( o )

Parameters

Returns

e as object: The event origination or source object.

_gevt_src

Returns the event source object. Method is private and should not be directly referenced.

Syntax

e = _gevt_src( o )

Parameters

Returns

e as object: The event source object.

_handle_event

A developer specified event handler that is invoked after binding an event to the _prehandle_event handler, and which has the context specified by the createHandler method. Method is private and should not be directly referenced.

Syntax

v = _handle_event( )

Returns

v as variant: Returns developer specified value.

_prehandle_event

Internal event handler used to establish context and to invoke the custom handler. Method is private and should not be directly referenced.

Syntax

v = _prehandle_event( )

Returns

v as variant: Returns value from

addEventBuffer

Creates the createHandler method on the specified object. Method is private and should not be directly referenced.

Syntax

void addEventBuffer( e )

Parameters

addEventListener

Adds an event listener to the specified object

Syntax

void addEventListener( o, e, f, b )

Parameters

createHandler

Creates a custom event handler, _prehandle_event, which invokes _handle_event for the specified object, using the specified context. This method must be created with addEventBuffer. Method is private and should not be directly referenced.

Syntax

f = createHandler( s, r, x, l )

Parameters

Returns

f as function: Custom event handler function.

disableMotionCapture

Removes motion capture (mousemove and mouseup) from the specified object.

Syntax

void disableMotionCapture( o )

Parameters

enableMotionCapture

Enables motion capture (mousemove and mouseup) for the specified object.

Syntax

void enableMotionCapture( o )

Parameters

getAbsoluteLeft

Returns the absolute left position of the specified node.

Syntax

i = getAbsoluteLeft( o, r )

Parameters

Returns

i as int: The absolute left of the specified object from the parent window.

getAbsolutePosition

Returns the absolute position of the specified node.

Syntax

i = getAbsolutePosition( o, r, b )

Parameters

Returns

i as int: The absolute position of the specified object from the parent window.

getAbsoluteTop

Returns the absolute top position of the specified node.

Syntax

i = getAbsoluteTop( o, r )

Parameters

Returns

i as int: The absolute top of the specified object from the parent window.

removeEventListener

Removes an event listener from the specified object

Syntax

void removeEventListener( o, e, f, b )

Parameters