Page object

This object references the current HMI device page. The page is the top-level object of the screen.

Page object properties

Properties available at page level.

backgroundColor

string backgroundColor (in format rgb(xxx, xxx, xxx) where xxx range from 0 to 255)

Page background color.

function btnStd11_onMouseRelease(me) {

page.backgroundColor = "rgb(128,0,0)";

}

(Available on web pages)

width

number width

Page width in pixels.

function btnStd05_onMouseRelease(me) {

var middle_x = page.width / 2;

}

(Available on web pages, get only)

height

number height

Page height in pixels.

function btnStd05_onMouseRelease(me) {

var middle_y = page.height / 2;

}

(Available on web pages, get only)

userValue

string userValue

Gets or sets a user-defined value for the widget. This field can be used by JavaScript functions to store additional data with the page.

function btnStd9_onMouseRelease(me) {

page.userValue = "Here I can store custom data";

}

(Available on web pages)

Page object methods

Methods that can be used at page level.

getWidget

object getWidget( wgtName )

Returns the widget with the given name.

Parameter Description
wgtName String containing the widget name
Return value

An object representing the widget. If the widget does not exist, null is returned.

function btnStd1_onMouseRelease(me) {

var my_button = page.getWidget("btnStd1");

}

(Available on web pages)

setTimeout

number setTimeout( functionName, delay )

Starts a timer to call a given function after a given delay.

Parameter Description
functionName String containing the name of function to call
delay Delay in milliseconds
Return value

A number corresponding to the timerID.

var duration = 3000;

var myTimer = page.setTimeout("innerChangeWidth()", duration);

(Available on web pages)

clearTimeout

void clearTimeout( timerID )

Stops and clears the timeout timer with the given timer.

Parameter Description
timerID Timer to be cleared and stopped

var duration = 3000;

var myTimer = page.setTimeout("innerChangeWidth()", duration);

// do something

page.clearTimeout(myTimer);

(Available on web pages)

setInterval

number setInterval( functionName, interval )

Starts a timer that executes the given function with the given interval.

Parameter Description
functionName String containing the name of function to call
interval Interval in milliseconds
Return value

A number corresponding to the timerID.

var interval = 3000;

var myTimer = page.setInterval("innerChangeWidth()", interval);

(Available on web pages)

clearInterval

void clearInterval( timerID )

Stops and clears the interval timer with the given timer.

Parameter Description
timerID Timer to be cleared and stopped

var interval = 3000;

var myTimer = page.setInterval("innerChangeWidth()", interval);

// do something

page.clearInterval(myTimer);

(Available on web pages)

clearAllTimeouts

void clearAllTimeouts()

Clears all the timers started.

page.clearAllTimeouts();

(Available on web pages)