18.01.2015 Views

Technical Reference Manual - InduSoft

Technical Reference Manual - InduSoft

Technical Reference Manual - InduSoft

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Overview of VBScript<br />

Graphic Module<br />

GRAPHICS SCRIPT<br />

The Graphics Script interface can be edited by its icon from the Graphics tab of the Project Explorer:<br />

This interface can be used to execute logics on the following events, based on pre-defined sub-routines:<br />

• Graphics_OnStart() : The code configured within this sub-routine is automatically executed just once<br />

when the graphic module is started. This interface is useful for initializing variables or executing logics<br />

that must be implemented when running the project.<br />

• Graphics_WhileRunning() : The code configured within this sub-routine is automatically executed<br />

continuously while the graphic module is running. The rate in which this sub-routine is called depends on<br />

the performance of the platform where the project is running.<br />

• Graphics_OnEnd() : The code configured within this sub-routine is automatically executed just once<br />

when the graphic module is closed.<br />

• Graphics_OnScreenResize( width, height ) : The code configured within this sub-routine is<br />

automatically executed just once when the screen resolution of the runtime station changes. The new<br />

width and height of the screen (in pixels) are passed to the sub-routine as parameters.<br />

Note: The Graphics_OnScreenResize() sub-routine is intended for projects running in CEView<br />

on Windows Embedded devices that can switch between Portrait and Landscape display modes. It<br />

is not supported for projects running on Windows PC or in the Thin Client.<br />

Example:<br />

Important: Do not change the name of the predefined sub-routines. If you do, then the system will<br />

not be able to automatically execute them.<br />

'Variables with local scope can be declared and initialized here<br />

Dim MyDate<br />

MyDate = Date()<br />

Dim MyValue<br />

MyValue = 100<br />

'Procedures with local scope can be implemented here<br />

Function MyNewProcedure(nCount)<br />

MyNewProcedure = nCount + 1<br />

End Function<br />

Function AreaRec(side1, side2)<br />

AreaRec = side1 * side2<br />

End Function<br />

Sub CheckHiLimit(myValue, myHiLimit)<br />

If myValue > myHiLimit Then<br />

MsgBox("Value out of range")<br />

End If<br />

End Sub<br />

Page 764<br />

<strong>InduSoft</strong> Web Studio

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!