"getCheckState"
Allows to query the checked state of a tree widget item.
Synopsis
shape.getCheckState(string id);
Parameter
Parameter | Description |
---|---|
shape | Name of the object. |
id | The ID of the tree widget item which should be queried. |
Description
getCheckState returns the checked state of a tree widget element as integer value. Following return values are available:
-
0 => The item is not checked
-
1 => The item is checked
-
2 => The item is not checked, but one ore mor child nodes are checked
-
3 => The item is checked, but one ore more child nodes are not selected
Note that a leave can only return 0 or 1.
Note
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 the function checkState the checked state of the item with the ID "id" can be queried and 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(string id)
{
DebugN(TREE1.getCheckState(id);//Returns the checked state of the item with the ID "id" to the log viewer
}
Assignment
Tree Widget