JavaScript Wizard API
Introduction
The Wizard library provides interactive controls for Wacom STU signature pads. Each screen can contain text, buttons, checkboxes, radio buttons, images, graphics primitives, PIN code input and signature capture. The Wizard control is part of the SDK's WebAssembly component.
A complete example is available in the wizard demo of the Signature JavaScript samples on GitHub.
Methods summary
Connection
| Method | Description |
|---|---|
| WizCtl constructor | Creates a Wizard control. |
| padConnect | Connects to an STU pad. |
| padDisconnect | Disconnects the pad. |
| padModelName | Returns the pad model name. |
| padWidth | Returns the pad screen width. |
| padHeight | Returns the pad screen height. |
Screen
| Method | Description |
|---|---|
| reset | Clears the control list and prepares the next screen. |
| setProperty | Sets drawing and control properties. |
| display | Shows the current screen on the pad. |
| fireClick | Simulates a tap on an object. |
Objects
| Method | Description |
|---|---|
| addObject | Adds an object of any type. |
| addObjectButton | Adds a button. |
| addObjectCheckBox | Adds a checkbox. |
| addObjectDisplayAtShutdown | Keeps the screen displayed after disconnection. |
| addObjectImage | Adds an image. |
| addObjectInking | Captures ink as an image. |
| addObjectInput | Adds PIN code input. |
| addObjectInputEcho | Shows the entered input. |
| addObjectRadioButton | Adds a radio button. |
| addObjectSignature | Captures a signature. |
| addObjectText | Adds text. |
| addPrimitive | Adds a line, rectangle or ellipse. |
Enumerations
The enumerations are available on the SDK module, for example sigSDK.ObjectType.ObjectButton.
To combine option values, use the value property of each value, for example sigSDK.PrimitiveOptions.LineSolid.value | sigSDK.PrimitiveOptions.Fill.value.
ObjectType
Identifies the object type in addObject.
| Value | Description |
|---|---|
ObjectText | Text. |
ObjectButton | Button. |
ObjectCheckbox | Checkbox. |
ObjectRadioButton | Radio button. |
ObjectSignature | Signature capture. |
ObjectInput | PIN code input. |
ObjectInputEcho | Input echo. |
ObjectImage | Image. |
ObjectDisplayAtShutdown | Keeps the screen displayed after disconnection. |
ObjectInking | Ink capture. |
ObjectPrimitive | Graphics primitive. |
ButtonOptions
Sets the text alignment and appearance of a button.
| Value | Description |
|---|---|
BtnAlignCentre | Centres the text horizontally. (Default) |
BtnAlignMiddle | Centres the text vertically. (Default) |
BtnAlignLeft | Aligns the text to the left. |
BtnAlignRight | Aligns the text to the right. |
BtnAlignTop | Aligns the text to the top. |
BtnAlignBottom | Aligns the text to the bottom. |
BtnInvert | Draws white text on a black background. |
BtnGreyed | Draws the button greyed out. |
BtnHiLiteClick | Highlights the button when it is tapped. |
CheckboxOptions
Sets the initial state and check symbol of a checkbox.
| Value | Description |
|---|---|
CheckboxUnchecked | Initially unchecked. (Default) |
CheckboxChecked | Initially checked. |
CheckboxDisplayTick | Shows a tick when checked. |
CheckboxDisplayCross | Shows a cross when checked. |
InputEchoOptions
Sets how an input echo displays the entered characters.
| Value | Description |
|---|---|
EchoNoSpacing | No space between characters. |
EchoHalfSpacing | Half a character space between characters. |
EchoSingleSpacing | One character space between characters. |
EchoDoubleSpacing | Two character spaces between characters. |
EchoUnderline | Underlines the echoed characters. |
PrimitiveType
Identifies the primitive type in addPrimitive.
| Value | Description |
|---|---|
Line | A line. |
Rectangle | A rectangle. |
Ellipse | An ellipse. |
PrimitiveOptions
Sets the line style and fill of a primitive.
| Value | Description |
|---|---|
LineSolid | Solid line. (Default) |
LineDashed | Dashed line. |
Outline | Draws the outline only. (Default) |
Fill | Fills the shape with the fill colour. |
FillXOR | Fills the shape using XOR. |
Wizard objects
The addObject* methods return an object that represents the item on the pad.
Depending on the type, the object has some of the following properties:
| Property | Object types | Description |
|---|---|---|
rect | All displayed objects | The displayed area, with upperLeftXpixel, upperLeftYpixel, lowerRightXpixel and lowerRightYpixel. |
onClick | Button, checkbox, radio button, image | Called when the object is tapped. It receives the object and returns a boolean. Return true to stop capturing pen input, or false to continue. |
checked | Checkbox | Indicates whether the checkbox is checked. |
onInput | Input | Called each time an input button is tapped. |
onSignatureCaptured | Signature | Called when the signature has been captured and accepted. |
onInkingCaptured | Inking | Called with the captured ink as a Base64-encoded PNG. |