Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Only tokens which are placed into token containers are handled by these functions. Imagecontrols are currently the only valid token container objects.


getDistanceBetween

...

Code Block
languagelua
function getDistanceBetween(token, token)

...

token (tokeninstance)   
tokeninstance object on the current image control.

...

Return values

(tokeninstance)
tokeninstance object representing the requested token, or nil if the container does not exist or the ID is not valid.

getTokensWithinDistance

...

Code Block
languagelua
function getTokensWithinDistance(token, distance)

...

token (tokeninstance)   
tokeninstance object on the current image control.

...

(table)
A table with integer index values containing references to tokeninstance objects contained in the control

...

target   (tokeninstance)   
The tokeninstance triggering the event.

onClickDown

Code Block
languagelua
function onClickDown(target, button, image)

...

target   (tokeninstance)   
The tokeninstance triggering the event

button   (number)   
Returns a numerical value indicating the button pressed (1 = left, 2 = middle, 4 = button 4, 5 = button 5). Right button is used for radial menus.

image   (imagecontrol)   
The imagecontrol object in which the token was clicked.

onClickRelease

Code Block
languagelua
function onClickRelease(target, button, image)

...

target   (tokeninstance)   
The tokeninstance triggering the event

button   (number)   
Returns a numerical value indicating the button released (1 = left, 2 = middle, 4 = button 4, 5 = button 5). Right button is used for radial menus.

image   (imagecontrol)   
The imagecontrol object in which the token was clicked.

onContainerChanged

Code Block
languagelua
function onContainerChanged(target, oldcontainernode, oldcontainerid)

...

target   (tokeninstance)   
The tokeninstance triggering the event

oldcontainernode   (databasenode)   
databasenode object representing the underlying database node of the old container, or nil if the no previous container found.

oldcontainerid   (number)   
The old ID of the token within the old container.

onDelete

Code Block
languagelua
function onDelete(target)

...

target   (tokeninstance)   
The tokeninstance triggering the event.

onDoubleClick

Code Block
languagelua
function onDoubleClick(target, image)

...

target   (tokeninstance)   
The tokeninstance triggering the event

image   (imagecontrol)   
The imagecontrol object in which the token was clicked.

onDrag

Code Block
languagelua
function onDrag(target, button, x, y, dragdata)

...

target   (tokeninstance)   
The tokeninstance triggering the event

button   (number)   
1 if the event was caused by the left mouse button, 2 if it was caused by the middle (wheel) button.

...

dragdata   (dragdata)   
dragdata object containing the state of values connected to the mouse cursor as part of a drag and drop operation.

...

(boolean)
This function should return true if it handled the event and the processing of the event should be stopped. A value of false indicates that the default framework functionality for the this particular control should not be executed, but the processing should continue for the element below this control, if any. A return value of nil (or the absence of a return statement) indicates that the framework should continue handling the event normally.

onDragEnd

Code Block
languagelua
function onDragEnd(target, dragdata)

This function is called when the mouse is released at the end of a drag operation that started on the token. The dragdata object is first passed to the Token handler in the receiving control, which can set properties in the dragdata object that notify this control of the events.

...

target   (tokeninstance)   
The tokeninstance triggering the event

dragdata   (dragdata)   
dragdata object containing the state of values connected to the mouse cursor as part of a drag and drop operation.

onDragStart

Code Block
languagelua
function onDragStart(target, button, x, y, dragdata)

...

target   (tokeninstance)   
The tokeninstance triggering the event

button   (number)   
1 if the event was caused by the left mouse button, 2 if it was caused by the middle (wheel) button.

...

dragdata   (dragdata)   
dragdata object containing the state of values connected to the mouse cursor as part of a drag and drop operation.

...

(boolean)
This function should return true if it handled the event and the processing of the event should be stopped. A value of false indicates that the default framework functionality for the this particular control should not be executed, but the processing should continue for the element below this control, if any. A return value of nil (or the absence of a return statement) indicates that the framework should continue handling the event normally.

onDrop

Code Block
languagelua
function onDrop(target, dragdata)

...

target   (tokeninstance)   
The tokeninstance triggering the eventdragdata   (dragdata)   
dragdata object containing the state of values connected to the mouse cursor as part of a drag and drop operation.

onHover

Code Block
languagelua
function onHover(target, state)

...

target   (tokeninstance)   
The tokeninstance triggering the event

state   (boolean)   
true if the mouse is entering the area, false if leaving

onHoverUpdate

Code Block
languagelua
function onHoverUpdate(target, x, y)

...

target   (tokeninstance)   
The tokeninstance triggering the event

x   (number)   
The X coordinate of the mouse pointer in pixels relative to the top left corner of the token

y   (number)   
The Y coordinate of the mouse pointer in pixels relative to the top left corner of the token

...

onMove

Code Block
languagelua
function onScaleChangedonMove(target)

This handler is called after a token 's individual scale is changedmoved.

Parameters

target   (tokeninstance)   
The tokeninstance triggering the event

onTargetUpdate

Code Block
languagelua
function onTargetUpdate(source, target, targeted)

...

source   (tokeninstance)   
The tokeninstance that is the targeting source.

target   (tokeninstance)   
The tokeninstance that is the targeting target.

targeted   (boolean)   
Whether the target token is currently targeted by the source token.

onWheel

Code Block
languagelua
function onWheel(target, notches)

...

target   (tokeninstance)   
The tokeninstance triggering the event

notches   (number)   
This number specifies the number of notches the wheel was spun. Typically one notch corresponds to one adjustment step on the wheel.