Tivoli Service Desk 6.0 Developer's Toolkit - Manuel de référence du langage TSD Script

Gestion des arbres

Retour à la page principale


DlgTreeInsert

Description.

Permet d'insérer un noeud "principal" dans l'arbre.

Syntaxe

Integer DlgTreeInsert( handle : WINDOW, treeId : STRING, REF node : TREENODE, label : STRING, userData : ANY, position : POSITION );

Remarques concernant les arguments

Nom de l'argument Description
handle Descripteur de la fenêtre de la boîte de dialogue contenant l'arbre
treeId ID de l'arbre
node Nouveau noeud inséré dans l'arbre
label Libellé devant apparaître dans le noeud de l'arbre
userData Données à associer avec le noeud inséré
position Relation utilisée pour déterminer comment doit être inséré le noeud

Exemple

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;

Codes retour

Code retour Description
1 La commande a abouti
0 Aucun contrôle d'arbre trouvé
-1 Descripteur de fenêtre erroné
-2 Valeur inconnue
-9 Syntaxe erronée

Voir aussi


DlgTreeClear

Description.

Supprime tous les noeuds d'un arbre.

Syntaxe

Integer DlgTreeClear( handle : WINDOW, treeId : STRING );

Remarques concernant les arguments

Nom de l'argument Description
handle Descripteur de la fenêtre de la boîte de dialogue contenant l'arbre
treeId ID de l'arbre

Exemple

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;

Codes retour

Code retour Description
1 La commande a abouti
-1 Descripteur de fenêtre erroné
-2 Valeur inconnue
-9 Syntaxe erronée

Voir aussi


DlgTreeActiveRedraw

Description

Permet de mettre à jour ou non la représentation graphique de l'arbre lorsque des noeuds y sont automatiquement ajoutés.

Syntaxe

Integer DlgTreeActiveRedraw( handle : WINDOW, treeId : STRING, state : BOOLEAN );

Remarques concernant les arguments

Nom de l'argument Description
Descripteur Descripteur de la fenêtre de la boîte de dialogue contenant l'arbre
TreeId ID de l'arbre
State Indicateur selon lequel la représentation graphique de l'arbre doit être mise à jour lorsque les noeuds sont insérés (TRUE pour oui, FALSE pour non)

Remarques

Lorsque vous désactivez la mise à jour de la représentation graphique, l'ajout de noeuds dans l'arbre se fait beaucoup plus rapidement. Lorsque tous les noeuds ont été ajoutés sur l'arbre, activer la mise à jour de la représenteation graphique permet de mettre à jour la représentation graphique de l'arbre.

Exemple

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;

Codes retour

Code retour Description
1 La commande a abouti
-1 Descripteur de fenêtre erroné
-2 Valeur inconnue
-9 Syntaxe erronée

Voir aussi


TreeInsert

Description

Permet de créer un nouveau noeud dans l'arbre en relation avec le noeud de référence.

Syntaxe

Integer TreeInsert( referenceNode : TREENODE, REF newNode : TREENODE, label
: STRING, userData : ANY, position : POSITION );

Remarques concernant les arguments

Nom de l'argument Description
referenceNode Noeud en relation avec le noeud inséré
newNode Valeur du noeud inséré
label Libellé devant apparaître dans le noeud de l'arbre
userData Données à associer avec le noeud inséré
position Relation entre le noeud de référence et le noeud inséré

Exemple

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;

Codes retour

Code retour Description
1 La commande a abouti
-1 Descripteur de fenêtre erroné
-2 Valeur inconnue
-9 Syntaxe erronée

Voir aussi


TreeDelete

Description

Supprime le noeud spécifié de l'arbre.

Syntaxe

Integer TreeDelete( node : TREENODE );

Remarques concernant les arguments

Nom de l'argument Description
node Noeud cible

Exemple

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;


Codes retour

Code retour Description
1 La commande a abouti
-2 Valeur inconnue

Voir aussi


TreeExpand

Description

Développe ou réduit le noeud.

Syntaxe

Integer TreeExpand( node : TREENODE, state : BOOLEAN );

Remarques concernant les arguments

Nom de l'argument Description
node Noeud cible
state Indicateur de l'état du noeud (TRUE pour développé, FALSE pour réduit)

Exemple

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;

Codes retour

Code retour Description
1 La commande a abouti
-2 Valeur inconnue

Voir aussi


TreeSelect

Description

Sélectionne le noeud indiqué.

Syntaxe

Integer TreeSelect( node : TREENODE );

Remarques concernant les arguments

Nom de l'argument Description
node Noeud cible

Exemple

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;

Codes retour

Code retour Description
1 La commande a abouti
-2 Valeur inconnue

Voir aussi


TreeFindNode

Description

Détermine quel noeud est en relation avec le noeud spécifié.

Syntaxe

Integer TreeFindNode( node : TREENODE, REF newNode : TREENODE, relatedHow : POSITION );

Remarques concernant les arguments

Nom de l'argument Description
node Noeud à partir duquel la recherche est lancée
newNode Noeud renvoyé après la recherche
relatedHow Relation entre le noeud initial et le noeud recherché

Exemple

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;

Codes retour

Code retour Description
1 La commande a abouti
0 Aucun contrôle d'arbre trouvé
-1 Descripteur de fenêtre erroné
-2 Valeur inconnue

Voir aussi


TreeSetData

Description

Associe des données avec le noeud spécifié. Les données peuvent être de n'importe quel type.

Syntaxe

Integer TreeSetData( node : TREENODE , userData : ANY );

Remarques concernant les arguments

Nom de l'argument Description
node Noeud cible
userData Données à associer avec le noeud

Exemple

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;

Codes retour

Code retour Description
1 La commande a abouti
-2 Valeur inconnue

Voir aussi


TreeGetData

Description

Extrait les données utilisateur associées au noeud.

Syntaxe

Integer TreeGetData( node : TREENODE, REF userData : ANY );

Remarques concernant les arguments

Nom de l'argument Description
node Noeud cible
userData Données extraites du noeud

Exemple

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;


Codes retour

Code retour Description
1 La commande a abouti
-1 Descripteur de fenêtre erroné
-2 Valeur inconnue

Voir aussi


TreeSetLabel

Description

Définit le libellé du noeud.

Syntaxe

Integer TreeSetLabel( node : TREENODE, label : STRING );

Remarques concernant les arguments

Nom de l'argument Description
node Noeud cible
label Libellé devant apparaître dans le noeud de l'arbre

Exemple

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;

Codes retour

Code retour Description
1 La commande a abouti
-2 Valeur inconnue

Voir aussi


TreeGetLabel

Description

Extrait le texte du noeud spécifié.

Syntaxe

Integer TreeGetLabel( node : TREENODE, REF label : STRING );

Remarques concernant les arguments

Nom de l'argument Description
node Noeud cible
label Libellé courant du noeud

Exemple

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;

Codes retour

Code retour Description
1 La commande a abouti
-1 Descripteur de fenêtre erroné
-2 Valeur inconnue

Voir aussi


TreeIsExpanded

Description

Détermine si le noeud est développé.

Syntaxe

Boolean TreeIsExpanded( node : TREENODE );

Remarques concernant les arguments

Nom de l'argument Description
node Noeud cible

Exemple

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;

Codes retour

Code retour Description
1 L'arbre est développé
0 L'arbre n'est pas développé
-2 Valeur inconnue

Voir aussi


TreeIsSelected

Description

Détermine si le noeud spécifié a été sélectionné.

Syntaxe

Boolean TreeIsSelected( node : TREENODE );

Remarques concernant les arguments

Nom de l'argument Description
node Noeud cible

Exemple

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;

Codes retour

Code retour Description
1 L'arbre est développé
0 L'arbre n'est pas développé
-2 Valeur inconnue

Voir aussi


Tivoli Service Desk 6.0 Developer's Toolkit - Manuel de référence du langage TSD Script

Retour à la page principale

Copyright