Packages
 Comm
 DB
 Debug
 Extension
 Input
 Interface
 Module
 Token
 User

Objects
 bitmapwidget
 databasenode
 dragdata
 textbasecontrol
 textwidget
 tokeninstance
 widget
 widgetcontainer
 windowcontrol
 windowinstance

Controls
 buttoncontrol
 buttonfield
 categoryselectioncontrol
 chatentry
 chatwindow
 databasecontrol
 diecontrol
 diefield
 formattedtextcontrol
 formattedtextfield
 genericcontrol
 imagecontrol
 numbercontrol
 numberfield
 portraitselectioncontrol
 scrollbarcontrol
 scrollercontrol
 stringcontrol
 stringfield
 subwindow
 tokenbag
 tokencontrol
 tokenfield
 windowlist
 windowreferencecontrol
 windowreferencefield

Assets and Settings
 announcement
 categoryselectionsettings
 characterdbroot
 customdie
 description
 desktopframe
 die
 diebox
 distance
 font
 framedef
 hotkeybar
 icon
 imageupdatefolder
 imagesettings
 importinfo
 importruleset
 includefile
 panel
 pollbox
 portraitset
 properties
 replaces
 script
 string
 template
 textsettings
 tokenroot
 tooltip
 windowclass
getToken
onAdd
onClickDown
onClickRelease
onContainerChanged
onDelete
onDoubleClick
onDrag
onDragEnd
onDragStart
onDrop
onHover
onHoverUpdate
onScaleChanged
onTargetUpdate
onWheel



This is a global built in package that provides global interfaces to token specific activities.

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



Interface


getToken

function getToken(containernodename, containerid)

Gets the tokeninstance object referred to by the container node name and ID parameters.

Parameters

containernodename   (string)   

The database path identifier for the container node

containerid   (number)   

The ID of the token within the container node

Return values

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

onAdd

function onAdd(target)

This handler is called when a token is added to a token container.

Parameters

target   (tokeninstance)   

The tokeninstance triggering the event


onClickDown

function onClickDown(target, button, image)

This handler is called when a mouse button is pressed down on a token.

Parameters

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

function onClickRelease(target, button, image)

This handler is called when a mouse button is released on a token.

Parameters

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

function onContainerChanged(target, oldcontainernode, oldcontainerid)

This handler is called after a token is dragged from one container to another.

Parameters

target   (tokeninstance)   

The tokeninstance triggering the event

oldcontainernode   (databasenode)   

A 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

function onDelete(target)

This handler is called just before a token is deleted.

Parameters

target   (tokeninstance)   

The tokeninstance triggering the event


onDoubleClick

function onDoubleClick(target, image)

This handler is called when the left mouse button is double-clicked on a token.

Parameters

target   (tokeninstance)   

The tokeninstance triggering the event

image   (imagecontrol)   

The imagecontrol object in which the token was clicked.


onDrag

function onDrag(target, button, x, y, dragdata)

This function is called when the mouse is moved after having been pressed down on the token. The event is called repeatedly as the user adjusts the mouse position.

Parameters

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.

x   (number)   

The X coordinate relative to the top left corner of the token

y   (number)   

The Y coordinate relative to the top left corner of the token

dragdata   (dragdata)   

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

Return values

(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

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 onDrop handler in the receiving control, which can set properties in the dragdata object that notify this control of the events.

Parameters

target   (tokeninstance)   

The tokeninstance triggering the event

dragdata   (dragdata)   

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


onDragStart

function onDragStart(target, button, x, y, dragdata)

This function is called when the mouse is moved after having been pressed down on the token. The event is called once.

If a customized drag and drop transfer is done, the dragdata parameter should be used to make the required changes.

Parameters

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.

x   (number)   

The X coordinate relative to the top left corner of the token

y   (number)   

The Y coordinate relative to the top left corner of the token

dragdata   (dragdata)   

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

Return values

(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

function onDrop(target, dragdata)

This handler is called when a drag and drop operation finishes on a token. The dragdata parameter should be used to access the dragged information.

To transfer information back to the object where the drag originated, the same dragdata object is passed to the onDragEnd function in that object.

Parameters

target   (tokeninstance)   

The tokeninstance triggering the event

dragdata   (dragdata)   

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


onHover

function onHover(target, state)

This handler is called when the hover state of a token changes.

Parameters

target   (tokeninstance)   

The tokeninstance triggering the event

state   (boolean)   

true if the mouse is entering the area, false if leaving


onHoverUpdate

function onHoverUpdate(target, x, y)

This handler is called when the mouse cursor is moved while over a token.

Parameters

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


onScaleChanged

function onScaleChanged(target)

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

Parameters

target   (tokeninstance)   

The tokeninstance triggering the event


onTargetUpdate

function onTargetUpdate(source, target, targeted)

This handler is called when the targeting information for a token is changed.

Parameters

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

function onWheel(target, notches)

This handler is called when the mouse wheel is spun over a token.

Parameters

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.



'Fantasy Grounds' is a trademark of SmiteWorks Ltd. All other trademarks are the property of their respective owners.
© 2004-2010 SmiteWorks Ltd. ALL RIGHTS RESERVED.
Privacy policy