WINDOW

Concept Link IconSee also Concept Link IconExample

Open and close windows under program control.

Partial WebVue support - See the table with the list of modes below. Not supported modes return an unsuccessful code if used in this context.

Mode Mnemonic Syntax WebVue support
0 CLOSE 1 Yes
1 OPEN 1, 2, 5 Yes
2 IS_OPEN 1 Yes
3 SHOW 1 No
4 HIDE 1 No
5 CHANGE 10 No
6 CLOSEUNDER 1 Yes
7 PRELOAD 1, 5 Yes
8 CLOSEALL 6 Yes
9 MAIN 3 No
10 CURRENTNAME 7 Yes
11 CURRENTBRANCH 7 Yes
12 CAPTION 8 No
13 REFSET 9 No
14 CURRENTREF 6 No
15 POPUPCLOSE 6 Yes
16 ACCESSLEVEL 1 Yes
17 OPENNEW 1, 2, 5 Yes
18 PRINT 1 No
19 ZOOM 11 No
20 GETREGION 1 No
21 GETSUBWINDOW 12 No
22 GETSUBBRANCH 12 No
23 SETPREVIOUS 6 No
24 LAYER 13 Yes
25 HARDCOPY 14 No
26 SAVE 15 No
27 SELECTTAB 16 No
28 GETCOLLECTION 17 Yes
29 GETSELECTEDTAB 18 No
30 GETTAB 19 No

Arguments common to more than one mode

Argument

Meaning

WinName

The name of a window. Type STR.

Branch

The name of a branch. Type STR.

Refset

The mode of operation of a window:

0 or MODE_REALTIME - Real time mode.

1 or MODE_REF1 - Mode REF1.

2 or MODE_REF2 - Mode REF2.

3 or MODE_TEST - Mode TEST.

When a mimic uses a reference set (Ref Set 1 or Ref Set 2), it receives values replayed from a stored report, not from the real time variables.

Syntax 1

IntVal = WINDOW( Mode, WinName, Branch [, Refset]);

Return type: INTEGER.

Execution

Mode

Mnemonic

Action

0

CLOSE

Close the window.

The execution will be unsuccessful, will return 0 and the window will not be closed if a dialog box is open for an animation in the mimic in Run mode, for example, a send command confirmation.

1

OPEN

Open the window.

The window is automatically moved to the foreground and given focus, even if it was already open before this call.

2

IS_OPEN

Test whether the window is open.

3

SHOW

Make a hidden window visible, move it to the foreground.

4

HIDE

Hide a window. The window is not closed and remains active in the background.

6

CLOSEUNDER

Close all windows that intersect WinName, whether in foreground or background.

7

PRELOAD

Loads the window into the cache, but it is not displayed.

16

ACCESSLEVEL

Return the access level of the window, or 0 if unsuccessful.

17

OPENNEW

Open a window. If the window is already open no action is taken.

18

PRINT

Print the selected window on the default printer.

Correct behavior of the HARDCOPY or PRINT modes may be affected by the operating system.

20

GETREGION

Return the region (on a multi-region system) in which the window is located, or 0 if unsuccessful.

 

 

Return: 1 if successful, else 0 for all modes except 16 & 20.

Syntax 2

IntVal = WINDOW(Mode, Child, Branch, Parent[, ParentBranch]);

Return type: INTEGER.

Argument

Meaning

Child

The name of a child window. Type STR.

Branch The branch of the child window. Type STR.

Parent

The name of a parent window. Type STR.

ParentBranch The branch of the parent window. Type STR.

Execution

Mode

Mnemonic

Action

1

OPEN

Open a window Child with branch Branch as a child of another window Parent (opened with branch ParentBranch).
The position of the child window is with respect to the origin of the parent window.
The instance of the Child and Branch window is only opened within the parent if it does not already exist in the workspace or another window.
Focus is transferred to the child window even if it is already open.

17

OPENNEW

Open a window Child with branch Branch as a child of another window Parent (opened with branch ParentBranch).
The position of the child window is with respect to the origin of the parent window.
The instance of the Child and Branch window is only opened within the parent if it does not already exist in the workspace or another window.
Focus is transferred to the child window only if it is not already open.

 

 

Return: 1 if successful, else 0.

The parent window must be open. The child window can only be moved within the bounds of the parent window. If the parent window is closed the child window also closes.

Syntax 3

IntVal = WINDOW(Mode, X, Y, Width, Height);

Return type: INTEGER.

Argument

Meaning

X, Y

The co-ordinates of the top left hand corner of the window, expressed in pixels. Type INTEGER.

Width

The width of the window expressed in pixels. Type INTEGER.

Height

The height of the window expressed in pixels. Type INTEGER.

Execution

Mode

Mnemonic

Action

9

MAIN

Change the position and size of the main workspace window.

Return: 1 if successful, else 0.

Syntax 5

IntVal =WINDOW(Mode, Child, ChildBranch, Parent, ParentBranch, dX, dY);

Return type: INTEGER.

Argument

Meaning

Child, ChildBranch, Parent, ParentBranch

See below.

dX, dY

Relative X and Y coordinates.

Execution

Mode

Mnemonic

Action

1

OPEN

Open a window Child with branch Branch as a child of another window Parent (opened with branch ParentBranch) using the supplied coordinates.
The position of the child window, with respect to the origin of the parent window, is calculated using the child window's configured position plus the relative X and Y coordinates.
The instance of the Child and Branch window is only opened within the parent if it does not already exist in the workspace or another window.
Focus is transferred to the child window even if it is already open.

7

PRELOAD

Loads the window into the cache using the supplied coordinates, but it is not displayed.

17

OPENNEW

Open a window Child with branch Branch as a child of another window Parent (open with branch ParentBranch) using the supplied coordinates.
The position of the child window, with respect to the origin of the parent window, is calculated using the child window's configured position plus the relative X and Y coordinates.
Focus is transferred to the child window only if it is not already open.

 

 

Return: 1 if successful, else 0.

For modes 1 and 17, the parent window must be open. The child window can only be moved within the bounds of the parent window. When the parent window closes, the child window also closes.

Syntax 6

IntVal = WINDOW(Mode);

Return type: INTEGER.

Execution

Mode

Mnemonic

Action

8

CLOSEALL

Close all open windows including any window in cache (not displayed).

It is equivalent to the action of the menu item File.Close all.

Return: 1 if successful, else 0.

15

POPUPCLOSE

Close any child window.

Return: 1 if successful, else 0.

23

SETPREVIOUS

Remove from the window stack the window one would obtain if a mimic open with #P were executed (previous window).

Return: 1 if successful, else 0.

14

CURRENTREF

Return 1 if the currently active window is in Reference status, else 0.

Return 0 if unsuccessful.

Syntax 7

StrVal = WINDOW(Mode);

Return type: STR.

Execution

Mode

Mnemonic

Action

10

CURRENTNAME

Return the name of the currently active window.

11

CURRENTBRANCH

Return the branch of the currently active window.

Syntax 8

IntVal = WINDOW(Mode, WinName, Branch, TitleLang1 [,TitleLang2]);

Return type: INTEGER.

Argument

Meaning

TitleLang1

The new window caption for language 1. Maximum length 40 characters.

TitleLang2 The new window caption for language 2. Optional. Maximum length 40 characters.

Execution

Mode

Mnemonic

Action

12

CAPTION

Change the window caption.

Several substitution strings are supported:

#D - Date in DD/MM/YY format.
#h - The time in HH:MM:SS format.
#B - Window's Branch.
#N - Current user name.

Return: 1 if successful, else 0.

Syntax 9

IntVal = WINDOW(Mode, WinName, Branch, OldMode, NewMode);

Return type: INTEGER.

Argument

Meaning

OldMode

The current mode of the window (see RefSet). Type INTEGER.

NewMode

The new mode for the window (See RefSet). Type INTEGER.

Execution

Mode

Mnemonic

Action

13

REFSET

Change the operational mode of the window identified by WinName, Branch and OldMode (its current reference set).

Return: 1 if successful, else 0

Syntax 10

IntVal = WINDOW(Mode, WinName, Branch, RefSet, X, Y, W, H);

Return type: INTEGER.

Argument

Meaning

X, Y

The co-ordinates of the top left hand corner of a window. Type INTEGER.

W, H

The width and height of a window. Type INTEGER.

Execution

Mode

Mnemonic

Action

5

CHANGE

Change the position and size of a window.

Return: 1 if successful, else 0.

This instruction does not work if the window contains a trend viewer, alarm viewer, log viewer or grid control.

Syntax 11

IntVal = WINDOW(Mode, WinName, Branch, X, Y, Zoom);

Return type: INTEGER.

Argument

Meaning

WinName

Window name.

Branch

Branch name.

X, Y

The co-ordinates of the central point of the displayed zone. Type INTEGER.

Zoom

The zoom percentage for the window. Type INTEGER.

Execution

Mode

Mnemonic

Action

10

ZOOM

Change the zoom level of the specified window.

The zoom center is the point (X, Y), relative coordinates within the window (as opposed to absolute coordinates within the workspace).

Return: 1 if successful, else 0.

Syntax 12

StrVal = WINDOW(Mode, Substitution[, MyWindow[, MyWindowBranch]]);

Return type: STR.

Argument

Meaning

Substitution

One of the substitution strings used with the Link Open animation. Type STR.

MyWindow

(for substitution type #Mx) The window that contains the links. Type STR.

MyWindowBranch

(for substitution type #Mx) The branch (if any) of that window. Type STR.

Execution

Mode

Mnemonic

Action

21

GETSUBWINDOW

Return the name of the window associated with the substitution string Substitution:

#P returns the name of the previous window opened.
#U returns the name of the User's primary window.
#I returns the first window opened when the project was started.
#Mx returns the name of one of the windows (x= 1 to 10) from the window's link tab.

22

GETSUBBRANCH

Return the name of the branch of the window associated with the substitution string Substitution.

    Return: An empty string if unsuccessful.

These instructions enable the use of substitutions strings #P, #U, #I and #Mx in scripts.
Retrieving #Mx substitution strings requires that the window containing the links is open and passed as parameters (MyWindow and MyWindowBranch).
In the case of a child window, #Mx substitutions are dealt with using the parameters of the parent window.

Syntax 13

IntVal = WINDOW(Mode, WinName, Branch, Refset, Layer, LayerMode);

Return type: INTEGER.

Argument

Meaning

Layer

Layer level (0 to 15). Type INTEGER.

LayerMode

The mode for the operation. (0, 1 or 2) Type INTEGER.

Execution

Mode

Mnemonic

Action

24

LAYER

Change the visibility status of the layer in the specified window, according to LayerMode:

0 Hide.

1 Show.

2 Toggle visibility.

Return: 1 if successful, else 0.

Syntax 14

IntVal = WINDOW(Mode, WinName, Branch [, Refset[, PrintMode]]);

Return type: INTEGER.

Argument

Meaning

PrintMode

Printing option. Type INTEGER.

0 Print without borders (default).
1 Print with borders.

Execution

Mode

Mnemonic

Action

25

HARDCOPY

Print a hard copy of the specified window on the operating system default printer. The window must be open or in the cache.

Return: 1 if successful, else 0

Correct behavior of the HARDCOPY or PRINT modes may be affected by the operating system.

Syntax 15

IntVal = WINDOW(Mode, WinName, Branch, Format);

Return type: INTEGER.

Argument

Meaning

Format

Mimic storage format. Type STR.

"NATIVE" - current format.
"BINARY" - binary format.
"ASCII32" - ASCII format.

Execution

Mode

Mnemonic

Action

26

SAVE

Save the window using the specified Format.

Return: 1 if successful, else 0

Syntax 16

IntVal = WINDOW(Mode, WinName, Branch, TabIndex);

Return type: INTEGER.

Argument

Meaning

TabIndex

The index of the tab to display. Type INTEGER.

Execution

Mode

Mnemonic

Action

27

SELECTTAB

For a window using tabs, select the tab corresponding to TabIndex.

Return: 1 if successful, else 0.

Syntax 17

IntVal = WINDOW(Mode, Namespace);

Return type: INTEGER.

Argument

Meaning

Namespace

The identifier of the output XML fragment. Type STR.

Execution

Mode

Mnemonic

Action

28

GETCOLLECTION

Retrieve the collection of opened windows in the XML fragment Namespace. For more information, see the example below and XMLPATH.

Return: Always 0.

Syntax 18

IntVal = WINDOW(Mode, WinName, Branch);

Return type: INTEGER.

Execution

Mode

Mnemonic

Action

29

GETSELECTEDTAB

Return the index of the selected / active tab. The first tab is 1 etc. Returns 0 if no tab is selected returns.

Syntax 19

StrVal = WINDOW(Mode, SubMode, WinName, Branch[, TabIndex]);

Return type: STRING

Argument

Meaning

SubMode Enumerated string, either "NAME", "BRANCH" or "CAPTION". Not case sensitive. Type STR.
TabIndex The 1-based index of the targeted tab, or 0 to address the active / selected one (default).

Execution

Mode

Mnemonic

Action

30

GETTAB Return the mimic name, branch or caption of the tab at index TabIndex.

Example

For an example, select the Example link above.