Skip to main content

addObjectImage

Displays an image on the pad. The image can optionally be clickable, in which case it generates click events when tapped with the pen.

wizCtl.addObjectImage(id, x, y, image, options)
ParameterDescription
id

String that identifies the image. Supports the same reserved values as button objects: ok, clear, cancel and delete. See addObjectButton.

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"
imageImage to display, for example a loaded HTMLImageElement.
options

Object with the dimensions used to draw the image. (Optional)

  • width - Width in pixels. If not set, the original image width is used.
  • height - Height in pixels. If not set, the original image height is used.
Return values
The added image 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 image 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 uses an image as a clickable button:

const acceptObj = wizCtl.addObjectImage("next", "right", "bottom", acceptImage, {width: 80, height: 40});
acceptObj.onClick = async function() {
await showNextStep();
return true;
}