"setChecked"
Sets the checked state of one or more tree widget items.
Synopsis
shape.setChecked(string id, bool checked);
shape.setChecked(dyn_string ids, dyn_bool checked);
shape.setChecked(mapping items);
Parameter
Parameter | Description |
---|---|
shape | Name of the object |
id | The ID of the tree widget item, that should set the checked state. |
ids | The IDs of the tree widget items, that should set the checked state. |
checked | Boolean value that defines whether the items are checked or not checked. |
items | A mapping containing the IDs for the values to set. |
Description
setChecked allows to set the checked state of one or more tree widget items. Multiple parameters can be used (bool, dyn_bool. mapping).
When using a mapping, the execution order of the items is undefined, which can lead to unexpected events when setting parent and child nodes at the same time.
Example
In this example multiple items are added to a tree widget node (WHOLE NAME) and afterwards set checkable. The function setCheck checks the items "MUELLER" and "KAUFMANN" inside of TREE1.
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.setChecked("WHOLE NAME",true);
TREE1.setChecked("MUELLER",true);
TREE1.setChecked("SCHMIDT",true);
TREE1.setChecked("KAUFMANN",true);
}
...
setCheck()
{
TREE1.setChecked(makeDynString("MUELLER","KAUFMANN"),makeDynBool(1,1));
}
Assignment
Tree Widget