ReplacePicture Subroutine

Closes a Picture and replaces it with another Picture. If a picture with a specified tag group file is already open in the WorkSpace, another instance of that picture with the same tag group file opens in the WorkSpace. The picture being opened will stretch or skew to fit the document height and width of the picture being replaced. The DisableAutoScale setting does not affect this behavior.

Syntax

ReplacePicture NewPicture, [OldPicture], [TagGroupFileName], [intErrorMode], [bShowPictureNotOpenErrors]; [CallingPicture]; [TSPicType]; [TagList]; [bNewInstance]

Properties

The ReplacePicture subroutine syntax has these parts:

Part

Description

NewPicture

String. The file name of the Picture you want to open.

OldPicture

String. (Optional) The file name of the Picture you want to replace. If no picture is specified, the currently active picture is replaced.

TagGroupFileName

String. (Optional) The file name of the Tag Group File you want to load with the new picture.

intErrorMode

Integer. (Optional) The error mode.
0 (default) – Allows the subroutines to provide the error messages. Errors are displayed in the form of a message box. If no entry is made for the intErrorMode parameter, the default is used.

1 – Allows the user to handle the error messages. Errors in the subroutines are passed back to the calling routine for handling.

2 – Writes errors to all destinations. No error messages display. Instead, the errors are written to all iFIX destinations, including the Alarm History window destinations using SendOperatorMessage.

bShowPictureNotOpenErrors

Boolean. (Optional).  If this value is set to TRUE, an error displays when the picture to be replaced is not open and no replace occurs.  The default is FALSE.

CallingPicture

Object. (Optional) The picture whose tag status functionality will be accessed.

TSPicType

TS_PIC_TYPE (Optional) The type of Tag Status picture to open:

0 – Single Tag Status picture

1 – Quick Trend picture

2 – Tag Control Panel picture

TagList

Variant. (Optional) An array of strings to be used in the tag status picture.

bNewInstance

Boolean. (Optional). Describes whether the picture is a new instance. This field is useful when opening multiple pictures. If the value is set to TRUE, a new instance of the same picture is opened. If the value is set to FALSE, then a new instance of the picture is not opened. The default is FALSE.

Remarks

Tag status functionality is available only when no NewPicture string has been provided and if the CallingPicture and TSPicType parameters are provided. If the CallingPicture parameter is not provided, the call to ReplacePicture is treated as an invalid ReplacePicture request. If the CallingPicture parameter is provided, but the TSPicType parameter is not, the call to ReplacePicture is treated as an invalid ReplacePicture request.

If a string has been provided via the NewPicture parameter, the standard ReplacePicture functionality is invoked. In this case the CallingPicture, TSPicType, and TagList parameters are ignored.

If possible, always make this call the last line in your script. Note that when the ReplacePicture subroutine is used, and the document being replaced is the document that contains the script, the call must be the last line in the script. Otherwise, you may experience unexpected behavior when executing the script.

If the ReplacePicture subroutine is not in the picture being replaced and is not the last line in your script, be certain that the operation is complete before the rest of the script continues to execute.

Example