GefScreen.OverlayEx (method)

Opens a screen file and overlays it on this screen object.
Syntax: Boolean = object.OverlayEx ( FileName, Project, VariableValues )
Parameters:
FileName As String - The name of the screen to open.
Project As String - If specified, determines the project used to qualify unqualified point IDs in the screen.
VariableValues As VARIANT - A CoCimSafeArray3 array of initial variable values for the newly opened screen. (Note: In VBScript and VBA/VB, you can use a native array of strings.)
Description:

The VariableValues parameter is a String array containing the initial values of variables in the new screen. If NVARS is the number of variables, the array should be dimensioned as

    Dim initVars as CoCimSafeArray2
    Set initVars = CreateObject("CIMPLICITY.CimSafeArray.2")
    cimsafe.CreateVector cimVString, 0, 2*NVARS

or

    Dim initVars(0 To 2*NVARS-1) as String

where initVars.Element(0) is the name of first variable and initVars.Element(1) is the value of the first variable.

This array may also be dimensioned as

    Dim initVars(0 To 1, 0 To NVARS-1) as String

in which case initVars(0,0) is the name of the first variable and initVars(1,0) is the value of the first variable.

Example:

Sub GefScreen_Overlay()
    
    Dim oCimScr As GefScreen
    Dim strProject As String
    
    Dim initVars As CoCimSafeArray2
    Set initVars = CreateObject("CIMPLICITY.CimSafeArray.2")
    initVars.CreateVector cimVString, 0, 6
    initVars.SetVectorElement 0, "\textobj\var"
    initVars.SetVectorElement 1, """sample text"""
    initVars.SetVectorElement 2, "screenvar"
    initVars.SetVectorElement 3, "1717"
    initVars.SetVectorElement 4, "varname3"
    initVars.SetVectorElement 5, "varvalue3"
    
    Set oCimScr = CimGetScreen
    strProject = PointGet("$PROJECT")
    If oCimScr.OverlayEx("SourceScr.Cim", strProject, initVars) = True Then
        MsgBox "The Screen was overlaid"
    Else
        MsgBox "The screen was not overlaid"
    End If
    
End Sub