Skip to main content

addObjectButton

Creates a button: text surrounded by a rectangle, which generates a click event when tapped with the pen. The text is displayed in the current font.

wizCtl.addObjectButton(id, x, y, text, options)
ParameterDescription
id

String that identifies the button. The following values have special meanings when used with a signature or input object:
ok - Accepts the current input. With a signature, stores the captured signature in the signature object and ends input. The button is disabled until a signature has been captured. With an input object, the button is disabled until the minimum number of characters has been entered.
clear - Clears the current input so that the user can start again. With a signature, clears any captured ink from the display. With an input object, clears all entered input.
cancel - With a signature, clears any captured ink and ends input.
delete - With an input object, deletes the last character.
With an input object, a single-character id (for example "1") adds that character to the input.

x, y

Position of the top-left corner of the object on the pad display.
The value is either an absolute position in pixels or one of the following strings:

  • x: "left", "right", "centre"
  • y: "top", "middle", "bottom"
textText to display.
options

Either an integer that specifies the button width in pixels, or a combination of sigSDK.ButtonOptions values.
If the width is less than the width of the text in the current font, it is ignored. (Optional)

Return values
The added button object. Throws an exception if an error occurs.

The returned object has the following properties:

PropertyDescription
rectThe displayed area, with upperLeftXpixel, upperLeftYpixel, lowerRightXpixel and lowerRightYpixel.
onClickFunction called when the button is tapped. It receives the object as a parameter and returns a boolean. Return true to stop capturing pen input, or false to continue.

The following example adds a button that moves the wizard to the next step:

const nextBtn = wizCtl.addObjectButton("next", "right", "bottom", "Next >>", 100);
nextBtn.onClick = async function() {
await showNextStep();
return true;
}
note

Do not use the onClick function of the ok button to read a captured signature. The event is raised even when no signature has been captured. Use the onSignatureCaptured function of the object returned by addObjectSignature instead.