Open

Open is a built-in scripting function that opens a project screen.

Function Group Execution Windows Embedded Thin Client
Open Screen Asynchronous Supported Supported Supported

Syntax

Open(strScreen { | ,optNumX1 { | ,optNumY1,optNumX2,optNumY2,optNumResizeFlag { | ,optNumID { | ,optStrMnemonicList } } } } )
strScreen
The name of the screen (not including the .scr extension) to be opened.
Note: Some Web servers are case-sensitive. If you plan to deploy your project as a Web application, then you should use only lowercase letters for the screen name.
optNumX1
optNumY1
optNumX2
optNumY2
The coordinates, in pixels, for the top-left (X1,Y1) and bottom-right (X2,Y2) corners of the screen.

These are optional parameters. If no values are specified, then the default screen size and location are used. For more information, see Screen Attributes.

Please note the following special circumstances:
  • You can open the screen at the mouse's current position by using Open( "screen", 1 ), or Open( "screen", 1, −1, −1, −1, … ) if the parameters at the end are needed.
  • If optNumX1 equals optNumX2 and optNumY1 equals optNumY2, then the default screen size is used but the screen is centered at (X1,Y1).
  • If optNumX2 is less than optNumX1 and/or optNumY2 is less than optNumY1, or if all four parameters are set to −1, then the parameters are ignored and the default screen size and location are used.
optNumResizeFlag
Specifies whether objects in the screen will be resized when the screen is opened:
Value Description
0 Screen objects will not be resized.
1 Screen objects will be automatically resized to fit the new dimensions of the screen, as specified by the coordinates described above. The resizing is done at the moment the screen is opened, so if the user changes the screen size after the screen is opened, then the objects will not be resized again.

This parameter is required if all four coordinates are specified.

optNumID
An ID or instance number to be assigned to the screen, because you can open multiple instances of the same screen file. (This ID is required when a screen is closed using the Close function.)

This is an optional parameter. If no value is specified, then the default ID is 0.

optStrMnemonicList
A string that describes how the custom properties of any generic objects or linked symbols in the screen will be completed when the screen is opened. This string has the syntax…
#Label:Value

…where Label is the name of the property and Value is the tag, expression or literal value that the property will receive. You can declare more than one mnemonic as long as the mnemonics are separated by spaces. For more information, see "Examples" below.

Returned value

This function will return one of the following values:
Value Description
0 Success
1 Error

Notes

This function cannot be used with Tasks or in the Global Procedures script.

Examples

Open the screen "main" using the default screen size and location:
Open( "main" )
Open the screen at the mouse's current position:
Open( "main", 1 )
Open the screen at the mouse's current position and assign it an ID of 10:
Open( "main", 1, −1, −1, −1, 0, 10)
Open the screen using the default screen size but centered at the coordinates (500,250), and assign it an ID of 10:
Open( "main", 500, 250, 500, 250, 0, 10)
Open the screen using the default screen size and location, and replace the custom properties Mne1 and Mne2 with Tag1 and Tag2, respectively:
Open( "main", −1, −1, −1, −1, 1, 0, "#Mne1:Tag1 #Mne2:Tag2" )