"getCheckedItems"

Returns a list of all checked items inside the Tree Widget.

Synopsis

shape.getCheckedItems([int whichItems]);

Parameter

Parameter Description
shape Name of the object
whichItems

Defines which kind of items are returned. Following options are available:

  • TREE_LEAVES => Only leafs are returned (default)

  • TREE_NODES => Only nodes are returned

The parameters can also be combined => (TREE_LEAVES | TREE_NODES)

Description

getCheckedItemes returns a dyn_string which contains all the selected elements inside the Tree Widget that match the whichItems condition.

Example

In this example multiple items (persons) are added to a Tree Widget (TREE1) under the parent node (WHOLE NAME) and afterwards set to checkable. With the function checked a list of all checked leaves is 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);
}
  ...
checked()
{
  DebugN(TREE1.getCheckedItems(TREE_LEAVES));//Returns a list of all checked leaves to the log viewer.
}

Assignment

Tree Widget