TREEVIEW

Concept Link IconSee also Concept Link IconExample

Access properties of the Tree View form 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
1 COUNT 1 Yes
2 GETSELECTEDINDEX 1 Yes
3 SETSELECTEDINDEX 2 Yes
4 GETTEXT 7 Yes
5 GETUSERDATA 7 Yes
6 GETROOT 1 Yes
7 GETCHILDNODE 3 Yes
8 GETNEXTNODE 3 Yes
9 GETPREVNODE 3 Yes
10 GETPARENTNODE 3 Yes

11

EXPANDNODE 3 Yes
12 COLLAPSENODE 3 Yes
13 LOAD 4 Yes
14 SETUSERDATA 5 Yes
15 SETTEXT 5 Yes
16 CLEAR 6 No
17 INSERTNODE 7 No
18 REMOVENODE 3 No
19 SETROOTICON 9 No
20 SETCHILDICON 10 No
21 SETNODEICON 11 No
22 ADDCHILD 7 Yes
23 SAVE 4 No

Arguments common to more than one mode

Argument

Meaning

Window The name of the window that contains the form control. Type STR.
Branch The branch (if any) of the window. Use "*" to indicate the current branch of the program. Type STR.
Identity The identity of the form control within the specified window. Type STR.
UseIndexedIcons Always used in conjunction with arguments CollapsedIcon and ExpandedIcon.
Flag to indicate if arguments CollapsedIcon and ExpandedIcon refer to the path to an icon file (non-indexed icons) or to the index of an icon (indexed icon from the icon selector). Type INTEGER.
1 = Use non-indexed icons.
2 = Use indexed icons.
CollapsedIcon If argument UseIndexedIcons equals 1: The path to the icon representing the node when it is collapsed. Type STR.
If argument UseIndexedIcons equals 2: The index of the icon (in the indexed icons part of the selector) representing the node when it is collapsed. Type INTEGER.
ExpandedIcon

If argument UseIndexedIcons equals 1: The path to the icon representing the node when it is expanded. Type STR.
If argument UseIndexedIcons equals 2: The index of the icon (in the indexed icons part of the selector) representing the node when it is expanded. Type INTEGER.

NodeId

The Id of a node. The first root node is assigned a node ID of 1, and subsequent nodes increment sequentially (e.g., 2, 3, etc.). Type INTEGER.

Syntax 1

LongVal = TREEVIEW(Mode, Window, Branch, Identity);

Return type: LONG

Execution

Mode

Mnemonic

Action

1

COUNT

Returns the number of nodes.

2

GETSELECTEDINDEX

Returns the id of the node that is currently selected.
6 GETROOT Returns the id of the root node.
    Return: 0 if unsuccessful.

Syntax 2

LongVal = TREEVIEW(Mode, Window, Branch, Identity, NodeId[, Notify]);

Return type: LONG

Argument

Meaning

Notify

To indicate whether the action triggers the execution of the SCADA Basic function defined in the Operations configuration of the form control. Type INTEGER.

Execution

Mode

Mnemonic

Action

3

SETSELECTEDINDEX

Select the node according to the value of the argument NodeId. If the NodeId is -1 then no node is selected. The function will scroll the control if necessary to display the node.

Return: 1 if successful, else 0.

Syntax 3

LongVal = TREEVIEW(Mode, Window, Branch, Identity, NodeId)

Return type: LONG

Execution

Mode

Mnemonic

Action

7 GETCHILDNODE

Returns the id of the first child node of a node.

Return: 0 if unsuccessful.

8 GETNEXTNODE

Returns the id of the next sibling node.

Return: 0 if unsuccessful.

9 GETPREVNODE

Returns the id of the previous sibling node.

Return: 0 if unsuccessful.

10 GETPARENTNODE

Returns the id of the parent node.

Return: 0 if unsuccessful.

11 EXPANDNODE

Expands the node with id NodeId.

Return: 1 if successful, else 0.

12 COLLAPSENODE

Collapses the node with id NodeId.

Return: 1 if successful, else 0.

18 REMOVENODE

Removes the node with id NodeId.

Return: 1 if successful, else 0.

Syntax 4

LongVal = TREEVIEW(Mode, Window, Branch, Identity, FileName);

Return type: LONG.

Argument

Meaning

FileName

The name of the file that contains the form control's data.

Execution

Mode

Mnemonic

Action

13

LOAD

Loads the file's content and replaces the form control's list of nodes.

Return: 1 if successful (file loaded and form control populated), else 0.

23 SAVE

Save the form control's list of nodes in a file. The form control's source must be set to File or the instruction will fail.

Return: 1 if successful (nodes saved in file), else 0.

Syntax 5

LongVal = TREEVIEW(Mode, Window, Branch, Identity,NodeId, StrVal]);

Return type: LONG.

Argument

Meaning

StrVal The string value to set.

Execution

Mode

Mnemonic

Action

14

SETUSERDATA

Sets the text of the node NodeId with value StrVal.

15 SETTEXT

Sets the user data associated to the node NodeId with value StrVal.

    Return: 1 if successful, else 0.

Syntax 6

LongVal = TREEVIEW(Mode, Window, Branch, Identity);

Return type: LONG.

Execution

Mode

Mnemonic

Action

16 CLEAR

Clears the entire contents of the tree view form control.

Return: 1 if successful, else 0.

Syntax 7

>LongVal = TREEVIEW(Mode, Window, Branch, Identity, NodeId, Text, UserData);

Return type: LONG.

Argument

Meaning

Text A text string. Type STR.
UserData A text string. Type STR.

Execution

Mode

Mnemonic

Action

17

INSERTNODE

Insert a new node as a sibling of NodeId.

Return: 1 if successful, else 0.

22 ADDCHILD

Insert a new node as a child node of NodeId.

Return: 1 if successful, else 0.

Syntax 8

StrVal = TREEVIEW(Mode, Window, Branch, Identity, NodeId);

Return type: STR

Argument

Meaning

Index

The id of the node to be retrieved.

Execution

Mode

Mnemonic

Action

4 GETTEXT

Returns the Text of the node NodeId as defined for the language currently in use.

Return: An empty string if unsuccessful.

5 GETUSERDATA

Returns the user data associated with the node NodeId.

Return: An empty string if unsuccessful.

Syntax 9

LongVal = TREEVIEW(Mode, Window, Branch, Identity, RootNumber, UseIndexedIcons, CollapsedIcon, ExpandedIcon);

Return type: LONG

Argument

Meaning

RootNumber

A value representing the root number between 1 and 50. Type INTEGER.

Execution

Mode

Mnemonic

Action

19 SETROOTICON

Set the icons at the specified root number.

Return: 1 is successful, else 0.

Syntax 10

LongVal = TREEVIEW(>Mode, Window, Branch, Identity, RootNumber, ChildLevel, UseIndexedIcons, CollapsedIcon, ExpandedIcon);

Return type: LONG

Argument

Meaning

RootNumber

A value representing the root number between 1 and 50. Type INTEGER.

ChildLevel A value representing the child level between 1 and 50. Type INTEGER.

Execution

Mode

Mnemonic

Action

20 SETCHILDICON

Set the icons at the specified root number and child level.

Return: 1 is successful, else 0.

Syntax 11

LongVal = TREEVIEW(Mode, Window, Branch, Identity, NodeId, UseIndexedIcons, CollapsedIcon, ExpandedIcon));

Return type: LONG

Execution

Mode

Mnemonic

Action

21 SETNODEICON

Set the icon for the node NodeId.

Return: 1 is successful, else 0.

Example

For an example, select the Example link above.