To edit the screen script for a project screen, do
one of the following:
- On the Graphics tab of the ribbon, in the Screen
group, click Script; or
- Right-click in the screen and then select
Screen Script option from the
shortcut menu.
This interface can be used to execute logics on the
following events, based on preconfigured sub-routines:
- Screen_IsClosedByReplace(): This procedure
determines whether the screen is automatically closed when another
screen is opened to replace it. If the procedure is given a value
of 0 or FALSE, then automatic closing is disabled. When
the function is given a positive value (e.g., 1) or TRUE, or if
the procedure is not declared at all, then automatic closing is
enabled.
- Screen_OnOpen(): The
code configured within this sub-routine is automatically executed
just once when the screen is opened.
- Screen_WhileOpen():
The code configured within this sub-routine is automatically
executed continuously while its screen is open. The rate in which
this sub-routine is called depends on the performance of the
platform where the project is running.
- Screen_OnClose():The
code configured within this sub-routine is automatically executed
just once when the screen is closed.
The variables and procedures declared in this
interface are available for the VBScript interfaces of the screen
where the Screen Script is configured.
CAUTION:
Do not change the
names of the preconfigured sub-routines described above. If you do,
then the system will not be able to call them.
Note:
- The execution of the Screen Script sub-routines on
the server is totally independent of the execution on the Thin
Client stations. In other words, these sub-routines are executed
asynchronously.
- The procedures and/or variables declared in the
Screen Script interface have local scope. They can be called only
from the specific screen on which they are declared.
Example:
'Variables available on this screen can be declared and initialized here
Dim Counter
'Procedures available on this screen can be implemented here
Function AreaCircle(radius)
AreaCircle = Sqr(radius) * $Pi()
End Function
Sub CheckLoLimit (myValue, myLoLimit)
If myValue < myLoLimit Then
MsgBox("Value out of range")
End If
End Sub
'This procedure determines whether the screen is automatically closed
Function Screen_IsClosedByReplace()
Screen_IsClosedByReplace = $ReplaceModeTag
End Function
'This procedure is executed just once when this screen is open
Sub Screen_OnOpen()
MsgBox("The screen was open!")
End Sub
'This procedure is executed continuously while this screen is open
Sub Screen_WhileOpen()
If Counter < 100 Then
Counter = Counter + 1
Else
Counter = 0
End If
$SimulationTag = Counter
End Sub
'This procedure is executed just once when this screen is closed
Sub Screen_OnClose()
MsgBox("The screen will be closed!")
End Sub