"getItemsCheckState"
Returns a mapping with the element ID as key and the checked state as value.
Synopsis
shape.getItemsCheckState([int whichItems]);
Parameter
Parameter | Description |
---|---|
shape | Name of the object |
whichItems |
Defines which kind of items are returned. Following options are available:
The parameters can be be combined => (TREE_LEAVES | TREE_NODES) |
Description
getItemsCheckState returns a mapping with the element ID as key and the checked state as value. The value can be one of the following:
-
0 => Item is not checked
-
1 => Item is checked
-
2 => Item is not checked, but one or more child nodes are checked
-
3 => Item is checked, but one or more child nodes are not checked
Example
In this example multiple items are added to the parent node WHOLE NAME of the tree widget TREE1. Afterwards all items are set checkable. With teh function checkState all nodes and leaves are copied to a mapping which is afterwards sent to the log viewer.
main()
{
//Add three columns
TREE1.addColumn("SURNAME");
TREE1.addColumn("FIRST NAME");
TREE1.addColumn("ADDRESS");
//append the item WHOLE NAME
TREE1.appendItemNC("","WHOLE NAME","WHOLE_NAME");
//append three leaves to WHOLE NAME
TREE1.appendItemNC("WHOLE NAME","MUELLER","Mueller");
TREE1.appendItemNC("WHOLE NAME","SCHMIDT","Schmidt");
TREE1.appendItemNC("WHOLE NAME","KAUFMANN","Kaufmann");
//Set the text for the leave node column "NAME"
TREE1.setText("MUELLER",1,"Maria");
TREE1.setText("SCHMIDT",1,"Anna");
TREE1.setText("KAUFMANN",1,"Jan");
//Set the text for the leave node column "ADDRESS"
TREE1.setText("MUELLER",2,"Hauptstr. 1");
TREE1.setText("SCHMIDT",2,"Wienerstr. 10");
TREE1.setText("KAUFMANN",2,"Nebenstr. 100");
//Set the checkable option for the items
TREE1.setCheckable("WHOLE NAME",true);
TREE1.setCheckable("MUELLER",true);
TREE1.setCheckable("SCHMIDT",true);
TREE1.setCheckable("KAUFMANN",true);
}
...
checkState()
{
DebugN(TREE1.getItemsCheckState(TREE_LEAVES|TREE_NODES));
//creates a mapping of all nodes and leaves inside the TREE1 and writes it to the log viewer.
}
Assignments
Tree Widget