diecontrol

Inherits

windowcontrol

Inherited By

diefield

Context

windowinstance

A die control contains a group of dice that can be of different types.

The control supports the "dice" dragdata type. Dropping dice on the control adds them to the list of dice contained in the control. Dragging from the control starts a die roll with the contained dice held.


Definition

<diecontrol name="..." > <noreset /> </diecontrol>

<diecontrol name="..." >

 

<noreset />

Disable reset by using the middle mouse button

</diecontrol>

 

Interface

addDie

function addDie(type)

Add a die to the list of dice in the control. The specified value should be one of the built in die types ("d4", "d6", "d8", "d10", "d12" or "d20") or a custom die type.

Parameters

type   (string)   
The die identifier

getDice

function getDice()

Get the dice contained in the control.

Return values

(table)
An integer indexed table containing strings specifying the types of the dice in the control

onValueChanged

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



reset

Empty the control, removing all dice.



setDice

Reset the entire contents of the control to match the list given. The table should contain integer indexed strings identifying the die, either using one of the built in types ("d4", "d6", "d8", "d10", "d12" or "d20") or a custom die type.

Parameters

dice   (table)   
An integer indexed table containing die identifier strings