Changing Displays Using Global Subroutines

The FactoryGlobals global subroutines provide you with commands that allow you to manage your operator displays. Picture management subroutines include:

Refer to the subroutines topic of the iFIX Automation Interfaces Electronic Book for more information on calling these subroutines.

In the next example, an overview display contains four push buttons that allow operators to monitor plant lines. The first button opens the first line picture, the second button opens the second line picture, and so forth.

Push Button Example

The VBA scripts that make the command buttons operational are provided in this section. The use of aliases (in the following script, Line is the name of an alias) gives the script control over the opening and closing of displays, regardless of the exact picture names. Each time the operator selects the appropriate button, the script closes any picture with an alias of Line, and reassigns the alias to the opened picture.

Example: Using an Alias to Open and Close Displays

Private Sub OpenLine1Command_Click()

     ClosePicture "Line"

     OpenPicture "Line1", "Line"

End Sub

 

Private Sub OpenLine2Command_Click()

     ClosePicture "Line"

     OpenPicture "Line2", "Line"

End Sub

 

Private Sub OpenLine3Command_Click()

     ClosePicture "Line"

     OpenPicture "Line3", "Line"

End Sub

 

Private Sub OpenLine4Command_Click()

     ClosePicture "Line"

     OpenPicture "Line4", "Line"

End Sub

The following script performs the same function using the ReplacePicture subroutine, without using aliases. With ReplacePicture, all pictures display in the same window:

Example: Using the ReplacePicture Subroutine

Private Sub OpenLine1Command_Click()

     ReplacePicture ("Line1")

End Sub

 

Private Sub OpenLine2Command_Click()

     ReplacePicture ("Line2")

End Sub

 

Private Sub OpenLine3Command_Click()

     ReplacePicture ("Line3")

End Sub

 

Private Sub OpenLine4Command_Click()

     ReplacePicture ("Line4")

End Sub