Supported Clients
SmartClient
WebClient
NGClient

Property Summary
Object
data
A data object that specific events can set, a user can set data back to the system for events that supports this.

Methods Summary
String
getElementName()
returns the name of the element, can be null if the form was the source of the event.
String
getFormName()
returns the name of the form the element was placed on.
Number
getModifiers()
Returns the modifiers of the event, see JSEvent.
Object
getSource()
returns the source component/element of the event.
Date
getTimestamp()
Returns the time the event occurred.
String
getType()
returns the event type see the JSEvents constants what it can return.
Number
getX()
Returns the x position of the event, relative to the component that fired it, if applicable.
Number
getY()
Returns the y position of the event, relative to the component that fired it, if applicable.

Property Details

data

A data object that specific events can set, a user can set data back to the system for events that supports this.

Returns

Object

Supported Clients

SmartClient,WebClient,NGClient

Sample

// A client design method that handles ondrag
if (event.getType() == JSEvent.ONDRAG)
{
     // the data is the selected elements array
     var elements = event.data;
     // only start a client design drag when there is 1 element
     if (elements.length == 1)
     {
     	return true;
     }
}

// code for a data drag method
event.data = "drag me!";
return DRAGNDROP.COPY;

// code for a data drop method
var data = event.data;
elemements[event.getElementName()].setText(data);
return true;

Methods Details

getElementName()

returns the name of the element, can be null if the form was the source of the event.

Returns

String

Supported Clients

SmartClient,WebClient,NGClient

Sample

if (event.getElementName() == 'myElement')
{
    elements[event.getElementName()].bgcolor = '#ff0000';
}

getFormName()

returns the name of the form the element was placed on.

Returns

String

Supported Clients

SmartClient,WebClient,NGClient

Sample

forms[event.getFormName()].myFormMethod();

getModifiers()

Returns the modifiers of the event, see JSEvent.MODIFIER_XXXX for the modifiers that can be returned.

Returns

Number

Supported Clients

SmartClient,WebClient,NGClient

Sample

//test if the SHIFT modifier is used.
if (event.getModifiers() & JSEvent.MODIFIER_SHIFT)
{
	//do shift action
}

getSource()

returns the source component/element of the event.
If it has a name the getElementName() is the name of this component.

Returns

Object

Supported Clients

SmartClient,WebClient,NGClient

Sample

// cast to runtime text field (change to anoter kind of type if you know the type)
/** @type {RuntimeTextField} */
var source = event.getSource();
var sourceDataProvider = source.getDataProviderID();

getTimestamp()

Returns the time the event occurred.

Returns

Date

Supported Clients

SmartClient,WebClient,NGClient

Sample

event.getTimestamp();

getType()

returns the event type see the JSEvents constants what it can return.
Plugins can create events with there own types.

Returns

String

Supported Clients

SmartClient,WebClient,NGClient

Sample

if (event.getType() == JSEvent.ACTION) 
{
	// its an action event.
}

getX()

Returns the x position of the event, relative to the component that fired it, if applicable.
For example drag'n'drop events will set the x,y positions.

Returns

Number

Supported Clients

SmartClient,WebClient,NGClient

Sample

var x = event.getX();
var xPrevious = previousEvent.getX();
var movedXPixels = x -xPrevious;

getY()

Returns the y position of the event, relative to the component that fired it, if applicable.
For example drag'n'drop events will set the x,y positions.

Returns

Number

Supported Clients

SmartClient,WebClient,NGClient

Sample

var y = event.getY();
var yPrevious = previousEvent.getY();
var movedYPixels = y -yPrevious;