Child pages
  • JSEvent

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Divcache
Div
iddescription
HTML Table
id
classservoy sSummary
Colgroup Tag
Col
width80px
Col
Table Head (thead)
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Constants Summary
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
ACTION
Constant returned by JSEvent.
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
DATACHANGE
Constant returned by JSEvent.
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
DOUBLECLICK
Constant returned by JSEvent.
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
FOCUSGAINED
Constant returned by JSEvent.
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
FOCUSLOST
Constant returned by JSEvent.
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
FORM
Constant returned by JSEvent.
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)MODIFIER_ALT
styleindexdisplay:none

DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY (EXCEPT INSIDE THE DIV BELOW WITH ID=DESCRIPTION), UNLESS YOU KNOW WHAT YOU'RE DOING.
THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO AUTO UPDATE THE CONTENT THROUGH THE DOC GENERATOR.

true
refresh100d
showRefreshtrue
iddoc
titleRefresh page
showDatetrue
retryEnable

servoy sReturnTypes2100%height: 30px;2Supported ClientssWordListSmartClientsWordListWebClientsWordListNGClientsWordListMobileClient

Table Row (tr)

Table Cell (td)
Number
Table Cell (td)MODIFIER_CTRL
servoy sSummary12%30%58%height: 30px;3Constants SummaryConstant returned by JSEvent.Constant returned by JSEvent.Constant returned by JSEvent.Constant returned by JSEvent.Constant returned by JSEvent.Constant returned by JSEvent.Constant for the ALT modifier that can be returned by JSEvent.Constant for the CTRL modifier that can be returned by JSEvent. Table Row (tr)
Table Cell (td)
Number
Table Cell (td)MODIFIER_META
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)MODIFIER_SHIFT
Constant for the META modifier that can be returned by JSEvent. Table Row (tr)
Table Cell (td)
String
Table Cell (td)NONE
Constant for the SHIFT modifier that can be returned by JSEvent.
Table Cell (td)
String
Table Cell (td)RIGHTCLICK
Constant returned by JSEvent. Table Row (tr)Constant returned by JSEvent.

HTML Table

idclassservoy sSummaryidclass

Colgroup Tag
Col
width80px
Col
Table Head (thead) Table Row (tr)styleservoy sSummary12%30%58%height: 30px;
Table Head (th)
colspan2
Property Summary
Table Row (tr)
Table Cell (td)
Object
Table Cell (td)data
3Property SummaryA data object that specific events can set, a user can set data back to the system for events that supports this. HTML Table

Colgroup Tag
Col
width80px
Col
Table Head (thead) Table Row (tr)styleservoy sSummaryid12%30%58%height: 30px;
Table Head (th)
colspan2
Method Summary
Table Row (tr)
Table Cell (td)
String
Table Cell (td)getElementName()
3Methods Summaryreturns the name of the element, can be null if the form was the source of the event. Table Row (tr)
Table Cell (td)
String
Table Cell (td)getFormName()
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)getModifiers()
returns the name of the form the element was placed on. Table Cell (td)getSource()
Returns the modifiers of the event, see JSEvent. Table Row (tr)
Table Cell (td)
Object
returns the source component/element of the event. Table Row (tr)
Table Cell (td)
Date
Table Cell (td)getTimestamp()
Returns the time the event occurred. Table Row (tr)
Table Cell (td)
String
Table Cell (td)getType()
returns the event type see the JSEvents constants what it can return. Table Row (tr)
Table Cell (td)
Number
Table Cell (td)getX()
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)getY()
Returns the x position of the event, relative to the component that fired it, if applicable.Returns the y position of the event, relative to the component that fired it, if applicable. HTML Table

constantclass Colgroup Tag Colcolspanservoy sDetail2width100%

Col
Table Head (thead) Table Row (tr)styleheight:30px; Table Head (th)colspan2Constants Details Table Body (tbody)ididACTION Table Row (tr)name

Table Cell (td)id

ACTION

Table Row (tr)des Table Cell (td) DivclasssIndent Table Row (tr)idConstant returned by JSEvent.getType() in a method that is attached to an onAction event.ret

Table Cell (td)

Returns

divsIndentclients

classsIndent
String
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
if (event.getType() == JSEvent.ACTION)
{
	// its an action event.
}
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idDATACHANGE
Table Row (tr)
idname
Table Cell (td)

DATACHANGE

Table Row (tr)
iddes
Table Cell (td) Div
classsIndent
Table Row (tr)id

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
DATACHANGEname

DATACHANGE

dessIndentConstant returned by JSEvent.getType() in a method that is attached to an onDataChange event.
ret

Table Cell (td)

Returns

divsIndentclients

classsIndent
String
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
if (event.getType() == JSEvent.DATACHANGE)
{
	// its a data change event
}
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idDOUBLECLICK
Table Row (tr)
idname
Table Cell (td)

DOUBLECLICK

Table Row (tr)
iddes
Table Cell (td) Div
classsIndent
Table Row (tr)id

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
DOUBLECLICKname

DOUBLECLICK

dessIndentConstant returned by JSEvent.getType() in a method that is attached to an onDoubleClick event.
tdret

Returns

divsIndentclients

classsIndent
String
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
if (event.getType() == JSEvent.DOUBLECLICK)
{
	// its a double click event.
}
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idFOCUSGAINED
Table Row (tr)
idname
Table Cell (td)

FOCUSGAINED

Table Row (tr)
iddes
Table Cell (td) Div
classsIndent
Table Row (tr)id

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
FOCUSGAINEDname

FOCUSGAINED

dessIndentConstant returned by JSEvent.getType() in a method that is attached to an onFocusGained or the forms onElementFocusGained event.
tdret

Returns

divsIndentclients

classsIndent
String
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
if (event.getType() == JSEvent.FOCUSGAINED)
{
	// its a focus gained event.
}
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idFOCUSLOST
Table Row (tr)
idname
Table Cell (td)

FOCUSLOST

Table Row (tr)
iddes
Table Cell (td) Div
classsIndent
Table Row (tr)id

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
FOCUSLOSTname

FOCUSLOST

dessIndentConstant returned by JSEvent.getType() in a method that is attached to an onFocusLost or the forms onElementFocusLost event.
tdret

Returns

divsIndentclients

classsIndent
String
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
if (event.getType() == JSEvent.FOCUSLOST)
{
	// its a focus lost event.
}
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idFORM
Table Row (tr)
idname
Table Cell (td)

FORM

Table Row (tr)
iddes
Table Cell (td) Div
classsIndent
Table Row (tr)id

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
FORMname

FORM

dessIndentConstant returned by JSEvent.getType() in a method that is attached to a form event (like onShow) or command (like onDeleteRecord)
ret

Table Cell (td)

Returns

divsIndentclients

classsIndent
String
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
if (event.getType() == JSEvent.FORM)
{
	// its a form event or command
}
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idMODIFIER_ALT
Table Row (tr)
idname
Table Cell (td)

MODIFIER_ALT

Table Row (tr)
iddes
Table Cell (td) Div
classsIndent
Table Row (tr)id

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
MODIFIER_ALTname

MODIFIER_ALT

dessIndentConstant for the ALT modifier that can be returned by JSEvent.getModifiers();
tdret

Returns

divsIndentclients

classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
//test if the SHIFT modifier is used.
if (event.getModifiers() & JSEvent.MODIFIER_SHIFT)
{
	//do shift action
}
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idMODIFIER_CTRL
Table Row (tr)
idname
Table Cell (td)

MODIFIER_CTRL

Table Row (tr)
iddes
Table Cell (td) Div
classsIndent
Table Row (tr)id

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
MODIFIER_CTRLname

MODIFIER_CTRL

dessIndentConstant for the CTRL modifier that can be returned by JSEvent.getModifiers();
tdret

Returns

divsIndentclients

classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
//test if the SHIFT modifier is used.
if (event.getModifiers() & JSEvent.MODIFIER_SHIFT)
{
	//do shift action
}
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idMODIFIER_META
Table Row (tr)
idname
Table Cell (td)

MODIFIER_META

Table Row (tr)
iddes
Table Cell (td) Div
classsIndent
Table Row (tr)id

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
MODIFIER_METAname

MODIFIER_META

dessIndentConstant for the META modifier that can be returned by JSEvent.getModifiers();
ret

Table Cell (td)

Returns

divsIndentclients

classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
//test if the SHIFT modifier is used.
if (event.getModifiers() & JSEvent.MODIFIER_SHIFT)
{
	//do shift action
}
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idMODIFIER_SHIFT
Table Row (tr)
idname
tdid

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
MODIFIER_SHIFTname

MODIFIER_SHIFT

Table Row (tr)classdes Table Cell (td) DivsIndent Table Row (tr)idConstant for the SHIFT modifier that can be returned by JSEvent.getModifiers();tdret

Returns

divsIndentclients

classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
//test if the SHIFT modifier is used.
if (event.getModifiers() & JSEvent.MODIFIER_SHIFT)
{
	//do shift action
}
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idNONE
Table Row (tr)
idname
Table Cell (td)

NONE

Table Row (tr)
iddes
Table Cell (td) Div
classsIndent
Table Row (tr)id

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
NONEname

NONE

dessIndentConstant returned by JSEvent.getType() if the event is not used in a known event or command.
tdret

Returns

divsIndentclients

classsIndent
String
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
if (event.getType() == JSEvent.NONE)
{
	// type is not set.
}
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idRIGHTCLICK
Table Row (tr)
idname
Table Cell (td)

RIGHTCLICK

Table Row (tr)
iddes
Table Cell (td) Div
classsIndent
Table Row (tr)id

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
RIGHTCLICKname

RIGHTCLICK

dessIndentConstant returned by JSEvent.getType() in a method that is attached to an onRightClick event.
tdret

Returns

divsIndentclients

classsIndent
String
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
if (event.getType() == JSEvent.RIGHTCLICK)
{
	// its a right click event.
}
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
HTML Table
idproperty
classservoy sDetail
Colgroup Tag
Col
colspan2
width100%
Col
Table Head (thead)
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Property Details
Table Body (tbody)
iddata
Table Row (tr)
idname
Table Cell (td)

data

Table Row (tr)
iddes
Table Cell (td) Div
classsIndent

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 

propertyservoy sDetail2100%height:30px2Property Detailsdataname

data

dessIndentA data object that specific events can set, a user can set data back to the system for events that supports this.
Table Row (tr)idtdret

Returns

div
Colgroup Tag
Col
colspan2
width100%
Col
Table Head (thead)
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Details
Table Body (tbody)
idgetElementName
Table Row (tr)
idname
Table Cell (td)

getElementName

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
getElementName
Span
()
Table Row (tr)
iddes
Table Cell (td) Div
classsIndent
sIndentclients

classsIndent
Object
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
// 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;
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
HTML Table
idfunction
classservoy sDetail

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 

functionservoy sDetail2100%height:30px2Methods DetailsgetElementNamename

getElementName()

dessIndentreturns the name of the element, can be null if the form was the source of the event.
Table Row (tr)idrettd

Returns

div Table Body (tbody)
idgetFormName
Table Row (tr)
idname
Table Cell (td)

getFormName

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
getFormName
Span
()
Table Row (tr)
iddes
Table Cell (td) Div
classsIndent
sIndentclients

classsIndent
String - a String representing the element name.
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
if (event.getElementName() == 'myElement')
{
    elements[event.getElementName()].bgcolor = '#ff0000';
}
Table Row (tr)
classlastDetailRow
Table Cell (td)
 

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
getFormNamename

getFormName()

dessIndentreturns the name of the form the element was placed on.
Table Row (tr)idtdret

Returns

div Table Body (tbody)
idgetModifiers
Table Row (tr)
idname
Table Cell (td)

getModifiers

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Number
Span
stylefont-weight: bold;
getModifiers
Span
()
Table Row (tr)
iddes
Table Cell (td) Div
classsIndent
sIndentclients

classsIndent
String - a String representing the form name.
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
forms[event.getFormName()].myFormMethod();
Table Row (tr)
classlastDetailRow
Table Cell (td)
 

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
getModifiersname

getModifiers()

dessIndentReturns the modifiers of the event, see JSEvent.MODIFIER_XXXX for the modifiers that can be returned.
Table Row (tr)idtdret

Returns

divsIndentclients

classsIndent
Number - an int which holds the modifiers as a bitset.
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
//test if the SHIFT modifier is used.
if (event.getModifiers() & JSEvent.MODIFIER_SHIFT)
{
	//do shift action
}
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idgetSource
Table Row (tr)
idname
Table Cell (td)

getSource

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Object
Span
stylefont-weight: bold;
getSource
Span
()
Table Row (tr)
iddes
Table Cell (td) Div
classsIndent

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
getSourcename

getSource()

dessIndentreturns the source component/element of the event.

Table Row (tr)id If it has a name the getElementName() is the name of this component.tdret

Returns

div Table Row (tr)
iddes
Table Cell (td) Div
classsIndent
sIndentclients

classsIndent
Object - an Object representing the source of this event.
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
// 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();
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idgetTimestamp
Table Row (tr)
idname
Table Cell (td)

getTimestamp

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Date
Span
stylefont-weight: bold;
getTimestamp
Span
()

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
getTimestampname

getTimestamp()

dessIndentReturns the time the event occurred.
Table Row (tr)idtdret

Returns

divsIndentclients

classsIndent
Date - a Date when this event happened.
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
event.getTimestamp();
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idgetType
Table Row (tr)
idname
Table Cell (td)

getType

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
getType
Span
()
Table Row (tr)
iddes
Table Cell (td) Div
classsIndent

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
getTypename

getType()

dessIndentreturns the event type see the JSEvents constants what it can return.

Table Row (tr)id Plugins can create events with there own types.ret

Table Cell (td)

Returns

divsIndentclients

classsIndent
String - a String representing the type of this event.
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
if (event.getType() == JSEvent.ACTION)
{
	// its an action event.
}
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idgetX
Table Row (tr)
idname
Table Cell (td)

getX

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Number
Span
stylefont-weight: bold;
getX
Span
()
Table Row (tr)
iddes
Table Cell (td) Div
classsIndent

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
getXname

getX()

dessIndentReturns the x position of the event, relative to the component that fired it, if applicable.

Table Row (tr)id For example drag'n'drop events will set the x,y positions.tdret

Returns

divsIndentclients

classsIndent
Number - an int representing the X position.
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
var x = event.getX();
var xPrevious = previousEvent.getX();
var movedXPixels = x -xPrevious;
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idgetY
Table Row (tr)
idname
Table Cell (td)

getY

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Number
Span
stylefont-weight: bold;
getY
Span
()
Table Row (tr)
iddes
Table Cell (td) Div
classsIndent

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
getYname

getY()

dessIndentReturns 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. Table Row (tr)idtdret

Returns

div
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
var y = event.getY();
var yPrevious = previousEvent.getY();
var movedYPixels = y -yPrevious;
Table Row (tr)
classlastDetailRow
Table Cell (td) sIndentclients

classsIndent
Number - an int representing the Y position.

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow