tokencontrol

Inherits

windowcontrol

Inherited By

tokenfield

Context

windowinstance

Token controls contain token prototypes, and can be used to create token instances on controls accepting tokens. The icon representing the token is drawn in the control. If the control's dimensions are smaller than the prototype bitmap, the token image is scaled to fit in the control.

See tokenfield for a database bound version of this control type.

The control has built-in support for the "token" dragdata type.


Definition

<tokencontrol name="..." > <empty > ... </empty> <nodrag /> <nodrop /> </tokencontrol>

<tokencontrol name="..." >

 

<empty > ... </empty>

The icon resource name of an icon drawn in the control if the token value is empty

<nodrag />

Disables drag operations originating from the control.

<nodrop />

Dropping tokens in the control does not modify the value of the control.

</tokencontrol>

 

Interface

getPrototype

function getPrototype()

Returns the string identifying the token prototype contained in the control. The prototype string is a file name locating the token prototype image in the application directory. It should only be used as an identifier, direct manipulation of the string value is not recommended.

Return values

(string)
A string identifying the token contained in the control.

onValueChanged

function onValueChanged()

If present, this function is executed whenever the value of this control changes.



populateFromImageNode

This function can be used to fetch a token instance from the program database. The prototype contained in the control is set to the prototype contained in the specified database node by the given id number, and the corresponding token instance is returned. The return value should be stored by the calling script if it is to be used as a reference.

Parameters

dbnodename   (string)   

A database reference identifier string specifying the database node. If this node is not an image value, the call will fail.

id   (number)   

A number value identifying a token instance in the specified image database node.

Return values

(tokeninstance)
The tokeninstance identified by the given parameters, or nil if not found.

setPrototype

Sets the string identifying the token prototype contained in the control. The prototype string is a file name locating the token prototype image in the application directory. Direct manipulation of this value is not recommended. Only strings obtained through secondary token sources (such as other tokencontrol instances or token containers) should be used.

Parameters

prototypename   (string)   

The string representing the token that is to be presented in the control