Tivoli 服务台 6.0 开发工具包脚本语言参考
树控件
返回主页
说明
将“根目录”级节点插到树中。
语法
Integer DlgTreeInsert( handle : WINDOW, treeId : STRING, REF node : TREENODE, label : STRING, userData : ANY, position : POSITION );
自变量说明
自变量名称 |
说明 |
handle |
包含树的对话框的窗口句柄 |
treeId |
树的 ID |
node |
插入到树中新创建的节点 |
label |
在插入的树节点上显示文本标签 |
userData |
与插入的树节点有关的数据 |
position |
用于确定如何插入新节点的关系 |
实例
KNOWLEDGEBASE example;ROUTINES
PROCEDURE example;
PRIVATE
TYPES
MyRecord IS RECORD
Field1 : STRING;
Field2 : STRING;
Field3 : STRING;
Field4 : STRING;
Field5 : STRING;END;
VARIABLES
ROUTINES
PROCEDURE example IS
VARIABLES
ret : Integer;
whdl : Window;
root : TreeNode;
rootRecord : MyRecord;
ACTIONS
ret := DlgCreate( $Desktop, whdl, 'tree[TREE_FORM]', $NullHandler );
DlgTreeInsert(whdl, 'TREE_CONTROL', root, 'Root', rootRecord, $FIRST );
WinWait(whdl);
END;
返回码
返回码 |
说明 |
1 |
命令成功完成 |
0 |
没有查找到的树控件 |
-1 |
错误的窗口句柄 |
-2 |
未知值 |
-9 |
错误的语法 |
另见
说明
删除树中的全部节点。
语法
Integer DlgTreeClear( handle : WINDOW, treeId : STRING );
自变量说明
自变量名称 |
说明 |
handle |
包含树的对话框的窗口句柄。 |
treeId |
树的 ID |
实例
KNOWLEDGEBASE example;
ROUTINES
PROCEDURE example;
PRIVATE
TYPES
MyRecord IS RECORD
Field1 : STRING;
Field2 : STRING;
Field3 : STRING;
Field4 : STRING;
Field5 : STRING;
END;
VARIABLES
ROUTINES
PROCEDURE example IS
VARIABLES
ret : Integer;
whdl : Window;
root : TreeNode;
rootRecord : MyRecord;
ACTIONS
ret := DlgCreate( $Desktop, whdl, 'tree[TREE_FORM]', $NullHandler );
DlgTreeInsert( whdl, 'TREE_CONTROL', root, 'Root', rootRecord, $FIRST );
DlgTreeClear( whdl, 'TREE_CONTROL' );
WinWait(whdl);
END;
返回码
返回码 |
说明 |
1 |
命令成功完成 |
-1 |
错误的窗口句柄 |
-2 |
未知值 |
-9 |
错误的语法 |
另见
说明
当将树节点按程序添加到树时,控件是否用图解法更新树。
语法
Integer DlgTreeActiveRedraw( handle : WINDOW, treeId : STRING, state : BOOLEAN );
自变量说明
自变量名称 |
说明 |
Handle |
包含树的对话框的窗口句柄。 |
TreeId |
树的 ID |
State |
当插入树节点时,代表是否用图解法更新树的标志 (TRUE 对应于是,FALSE 对应于否) |
注释
通过关闭活动的重画,使向树中添加节点变得快一些。将所有节点添加到树中之后,打开活动的重画,用图解法更新树。
实例
KNOWLEDGEBASE example;
ROUTINESPROCEDURE example;
PRIVATE
TYPES
MyRecord IS RECORD
Field1 : STRING;
Field2 : STRING;
Field3 : STRING;
Field4 : STRING;
Field5 : STRING;END;
VARIABLES
ROUTINES
PROCEDURE example IS
VARIABLES
ret : Integer;
whdl : Window;
root : TreeNode;
node : TreeNode;
rootRecord : MyRecord;
nodeRecord : MyRecord;
ACTIONS
ret := DlgCreate( $Desktop, whdl, 'tree[TREE_FORM]', $NullHandler );
DlgTreeInsert( whdl, 'TREE_CONTROL', root, 'Root', rootRecord, $FIRST );
DlgTreeActiveRedraw( whdl, 'TREE_CONTROL', FALSE );
TreeInsert( root, node, 'Node', nodeRecord, $FIRSTCHILD );
DlgTreeActiveRedraw( whdl, 'TREE_CONTROL', TRUE );
WinWait(whdl);
END;
返回码
返回码 |
说明 |
1 |
命令成功完成 |
-1 |
错误的窗口句柄 |
-2 |
未知值 |
-9 |
错误的语法 |
另见
说明
在相对于参考节点的树中创建新节点。
语法
Integer TreeInsert( referenceNode : TREENODE, REF newNode : TREENODE, label
: STRING, userData : ANY, position : POSITION );
自变量说明
自变量名称 |
说明 |
referenceNode |
与插入节点有关的节点
|
newNode |
插入节点的值
|
label |
在插入的树节点显示文本标签
|
userData |
与插入的树节点有关的数据
|
position |
引用节点和插入节点的关系 |
实例
KNOWLEDGEBASE example;
ROUTINES
PROCEDURE example;
PRIVATE
TYPES
MyRecord IS RECORD
Field1 : STRING;
Field2 : STRING;
Field3 : STRING;
Field4 : STRING;
Field5 : STRING;
END;
VARIABLES
ROUTINES
PROCEDURE example IS
VARIABLES
ret : Integer;
whdl : Window;
root : TreeNode;
node : TreeNode;
rootRecord : MyRecord;
nodeRecord : MyRecord;
ACTIONS
ret := DlgCreate( $Desktop, whdl, 'tree[TREE_FORM]', $NullHandler );
DlgTreeInsert( whdl, 'TREE_CONTROL', root, 'Root', rootRecord, $FIRST );
TreeInsert( root, node, 'Node', nodeRecord, $FIRSTCHILD );
TreeExpand( root, TRUE );
WinWait(whdl);
END;
返回码
返回码 |
说明 |
1 |
命令成功完成 |
-1 |
错误的窗口句柄 |
-2 |
未知值 |
-9 |
错误的语法 |
另见
说明
删除树中指定的树节点。
语法
Integer TreeDelete( node : TREENODE );
自变量说明
实例
KNOWLEDGEBASE example;
ROUTINES
PROCEDURE example;
PRIVATE
TYPES
MyRecord IS RECORD
Field1 : STRING;
Field2 : STRING;
Field3 : STRING;
Field4 : STRING;
Field5 : STRING;
END;
VARIABLES
ROUTINES
PROCEDURE example IS
VARIABLES
ret : Integer;
whdl : Window;
root : TreeNode;
rootRecord : MyRecord;
ACTIONS
ret := DlgCreate( $Desktop, whdl, 'tree[TREE_FORM]', $NullHandler );
DlgTreeInsert( whdl, 'TREE_CONTROL', root, 'Root', rootRecord, $FIRST );
TreeDelete( root );
WinWait(whdl);
END;
返回码
另见
说明
展开或收缩指定的树节点。
语法
Integer TreeExpand( node : TREENODE, state : BOOLEAN );
自变量说明
自变量名称 |
说明 |
node |
目标树节点 |
state |
表示节点的展开状态的标志(TRUE 对应于展开,FALSE 对应于收缩) |
实例
KNOWLEDGEBASE example;
ROUTINES
PROCEDURE example;
PRIVATE
TYPES
MyRecord IS RECORD
Field1 : STRING;
Field2 : STRING;
Field3 : STRING;
Field4 : STRING;
Field5 : STRING;
END;
VARIABLES
ROUTINES
PROCEDURE example IS
VARIABLES
ret : Integer;
whdl : Window;
root : TreeNode;
node : TreeNode;
rootRecord : MyRecord;
nodeRecord : MyRecord;
ACTIONS
ret := DlgCreate( $Desktop, whdl, 'tree[TREE_FORM]', $NullHandler );
DlgTreeInsert( whdl, 'TREE_CONTROL', root, 'Root', rootRecord, $FIRST );
TreeInsert( root, node, 'Node', nodeRecord, $FIRSTCHILD );
TreeExpand( root, TRUE ); -- Expand the root node
TreeExpand( root, FALSE ); -- Collapse the root node
WinWait(whdl);
END;
返回码
另见
说明
选择指定的树节点。
语法
Integer TreeSelect( node : TREENODE );
自变量说明
实例
KNOWLEDGEBASE example;
ROUTINES
PROCEDURE example;
PRIVATE
TYPES
MyRecord IS RECORD
Field1 : STRING;
Field2 : STRING;
Field3 : STRING;
Field4 : STRING;
Field5 : STRING;
END;
VARIABLES
ROUTINES
PROCEDURE example IS
VARIABLES
ret : Integer;
whdl : Window;
root : TreeNode;
node : TreeNode;
rootRecord : MyRecord;
nodeRecord : MyRecord;
ACTIONS
ret := DlgCreate( $Desktop, whdl, 'tree[TREE_FORM]', $NullHandler );
DlgTreeInsert( whdl, 'TREE_CONTROL', root, 'Root', rootRecord, $FIRST );
TreeInsert( root, node, 'Node', nodeRecord, $FIRSTCHILD );
TreeSelect( root );
WinWait(whdl);
END;
返回码
另见
说明
确定与指定节点有关的节点。
语法
Integer TreeFindNode( node : TREENODE, REF newNode : TREENODE, relatedHow : POSITION );
自变量说明
自变量名称 |
说明 |
node |
要从中搜索的树节点 |
newNode |
从搜索中返回的树节点 |
relatedHow |
原始节点与请求节点的关系 |
实例
KNOWLEDGEBASE example;
ROUTINES
PROCEDURE example;
PRIVATE
TYPES
MyRecord IS RECORD
Field1 : STRING;
Field2 : STRING;
Field3 : STRING;
Field4 : STRING;
Field5 : STRING;
END;
VARIABLES
ROUTINES
PROCEDURE example IS
VARIABLES
ret : Integer;
whdl : Window;
root : TreeNode;
node : TreeNode;
foundNode : TreeNode;
rootRecord : MyRecord;
nodeRecord : MyRecord;
ACTIONS
ret := DlgCreate( $Desktop, whdl, 'tree[TREE_FORM]', $NullHandler );
DlgTreeInsert( whdl, 'TREE_CONTROL', root, 'Root', rootRecord, $FIRST );
TreeInsert( root, node, 'Node', nodeRecord, $FIRSTCHILD ); ret := TreeFindNode( root, foundNode, $FIRSTCHILD );
if ( ret = 1 ) then
-- Found it...
TreeExpand( root, TRUE );
TreeSelect( foundNode );
WinMessageBox( $Desktop, 'Node Search', $MBOK, 'Found' );
else
-- Not found...
WinMessageBox( $Desktop, 'Node Search', $MBOK, 'Not found' );
end;
WinWait(whdl);
END;
返回码
返回码 |
说明 |
1 |
命令成功完成 |
0 |
没有查找到的树控件 |
-1 |
错误的窗口句柄 |
-2 |
未知值 |
另见
说明
将数据与指定的树节点联系起来。此数据可以为任意类型。
语法
Integer TreeSetData( node : TREENODE , userData : ANY );
自变量说明
自变量名称 |
说明 |
node |
目标树节点 |
userData |
与树节点有关的数据 |
实例
KNOWLEDGEBASE example;
ROUTINES
PROCEDURE example;
PRIVATE
TYPES
MyRecord IS RECORD
Field1 : STRING;
Field2 : STRING;
Field3 : STRING;
Field4 : STRING;
Field5 : STRING;
END;
VARIABLES
ROUTINES
PROCEDURE example IS
VARIABLES
ret : Integer;
whdl : Window;
root : TreeNode;
rootRecord : MyRecord;
ACTIONS
ret := DlgCreate( $Desktop, whdl, 'tree[TREE_FORM]', $NullHandler );
DlgTreeInsert( whdl, 'TREE_CONTROL', root, 'Root', rootRecord, $FIRST );
rootRecord.Field1 := 1;
rootRecord.Field2 := 2;
rootRecord.Field3 := 3;
rootRecord.Field4 := 4;
rootRecord.Field5 := 5;
TreeSetData( root, rootRecord );
WinWait(whdl);
END;
返回码
另见
说明
检索与指定的树节点有关的用户数据。
语法
Integer TreeGetData( node : TREENODE, REF userData : ANY );
自变量说明
自变量名称 |
说明 |
node |
目标树节点 |
userData |
从树节点中检索的数据 |
实例
KNOWLEDGEBASE example;
ROUTINES
PROCEDURE example;
PRIVATE
TYPES
MyRecord IS RECORD
Field1 : STRING;
Field2 : STRING;
Field3 : STRING;
Field4 : STRING;
Field5 : STRING;
END;
VARIABLES
ROUTINES
PROCEDURE example IS
VARIABLES
ret : Integer;
whdl : Window;
root : TreeNode;
rootRecord : MyRecord;
newRecord : MyRecord;
ACTIONS
ret := DlgCreate( $Desktop, whdl, 'tree[TREE_FORM]', $NullHandler );
rootRecord.Field1 := 1;
rootRecord.Field2 := 2;
rootRecord.Field3 := 3;
rootRecord.Field4 := 4;
rootRecord.Field5 := 5;
DlgTreeInsert( whdl, 'TREE_CONTROL', root, 'Root', rootRecord, $FIRST );
TreeGetData( root, newRecord );
WinWait(whdl);
END;
返回码
返回码 |
说明 |
1 |
命令成功完成 |
-1 |
错误的窗口句柄 |
-2 |
未知值 |
另见
说明
设置指定树节点的文本标签。
语法
Integer TreeSetLabel( node : TREENODE, label : STRING );
自变量说明
自变量名称 |
说明 |
node |
目标树节点 |
label |
在树节点上显示文本标签 |
实例
KNOWLEDGEBASE example;
ROUTINES
PROCEDURE example;
PRIVATE
TYPES
MyRecord IS RECORD
Field1 : STRING;
Field2 : STRING;
Field3 : STRING;
Field4 : STRING;
Field5 : STRING;
END;
VARIABLES
ROUTINES
PROCEDURE example IS
VARIABLES
ret : Integer;
whdl : Window;
root : TreeNode;
rootRecord : MyRecord;
ACTIONS
ret := DlgCreate( $Desktop, whdl, 'tree[TREE_FORM]', $NullHandler );
DlgTreeInsert( whdl, 'TREE_CONTROL', root, 'Root', rootRecord, $FIRST );
TreeSetLabel( root, 'New Root' );
WinWait(whdl);
END;
返回码
另见
说明
检索指定的树节点的文本标签。
语法
Integer TreeGetLabel( node : TREENODE, REF label : STRING );
自变量说明
自变量名称 |
说明 |
node |
目标树节点 |
label |
在树节点上显示当前的文本标签
|
实例
KNOWLEDGEBASE example;
ROUTINES
PROCEDURE example;
PRIVATE
TYPES
MyRecord IS RECORD
Field1 : STRING;
Field2 : STRING;
Field3 : STRING;
Field4 : STRING;
Field5 : STRING;
END;
VARIABLES
ROUTINES
PROCEDURE example IS
VARIABLES
ret : Integer;
whdl : Window;
root : TreeNode;
rootRecord : MyRecord;
rootLabel : String;
ACTIONS
ret := DlgCreate( $Desktop, whdl, 'tree[TREE_FORM]', $NullHandler );
DlgTreeInsert( whdl, 'TREE_CONTROL', root, 'Root', rootRecord, $FIRST );
TreeGetLabel( root, rootLabel );
WinWait(whdl);
END;
返回码
返回码 |
说明 |
1 |
命令成功完成 |
-1 |
错误的窗口句柄 |
-2 |
未知值 |
另见
说明
确定是否要展开指定的树节点。
语法
Boolean TreeIsExpanded( node : TREENODE );
自变量说明
实例
KNOWLEDGEBASE example;
ROUTINES
PROCEDURE example;
PRIVATE
TYPES
MyRecord IS RECORD
Field1 : STRING;
Field2 : STRING;
Field3 : STRING;
Field4 : STRING;
Field5 : STRING;
END;
VARIABLES
ROUTINES
PROCEDURE example IS
VARIABLES
ret : Integer;
expanded : Boolean;
whdl : Window;
root : TreeNode;
node : TreeNode;
rootRecord : MyRecord;
nodeRecord : MyRecord;
ACTIONS
ret := DlgCreate( $Desktop, whdl, 'tree[TREE_FORM]', $NullHandler );
DlgTreeInsert( whdl, 'TREE_CONTROL', root, 'Root', rootRecord, $FIRST );
TreeInsert( root, node, 'Node', nodeRecord, $FIRSTCHILD ); expanded := TreeIsExpanded( root );
if ( expanded ) then
-- Tree node is expanded...
Nothing;
else
-- Tree node is not expanded...
Nothing;
end;
WinWait(whdl);
END;
返回码
返回码 |
说明 |
1 |
展开树 |
0 |
不展开树 |
-2 |
未知值 |
另见
说明
确定是否要选择指定的树节点。
语法
Boolean TreeIsSelected( node : TREENODE );
自变量说明
实例
KNOWLEDGEBASE example;
ROUTINES
PROCEDURE example;
PRIVATE
TYPES
MyRecord IS RECORD
Field1 : STRING;
Field2 : STRING;
Field3 : STRING;
Field4 : STRING;
Field5 : STRING;
END;
VARIABLES
ROUTINES
PROCEDURE example IS
VARIABLES
ret : Integer;
selected : Boolean;
whdl : Window;
root : TreeNode;
node : TreeNode;
rootRecord : MyRecord;
nodeRecord : MyRecord;
ACTIONS
ret := DlgCreate( $Desktop, whdl, 'tree[TREE_FORM]', $NullHandler );
DlgTreeInsert( whdl, 'TREE_CONTROL', root, 'Root', rootRecord, $FIRST );
TreeInsert( root, node, 'Node', nodeRecord, $FIRSTCHILD );
selected := TreeIsSelected( root );
if ( selected ) then
-- Tree node is selected...
Nothing;
else
-- Tree node is not selected...
Nothing;
end;
WinWait(whdl);
END;
返回码
返回码 |
说明 |
1 |
展开树 |
0 |
不展开树 |
-2 |
未知值 |
另见
Tivoli 服务台 6.0 开发工具包脚本语言参考
返回主页
版权所有