2.6 :childcount()

This method is used for the treeview object to query the number of subelements belonging to a tree element. Via parameters you can control how many indention levels are to be considered for the calculation.

Definition

integer :childcount
(
      integer Position input
  { , integer Levels   := 65535 input }
)

Parameters

integer Position input
In this parameter the index of the item is specified which the number of subelements in a tree is to be calculated for.
integer Levels := 65535 input
In this optional parameter the maximum indention level to be considered for the items can be specified. If this parameter is not specified all items will be considered.

Return value

Number of found elements

Objects with this method

treeview

Example

window Wn
{
  .title "Example for method :childcount()";
  child treeview Tv
  {
    .content[1] "Company A";
    .content[2] "Miller";
    .content[3] "Meyer";
    .content[4] "Company B";
    .content[5] "Davis";
    .content[6] "Smith";
    .content[7] "Fisher";
    .style[style_lines]   true;
    .style[style_buttons] true;
    .style[style_root]    true;
    .level[2] 2;
    .level[3] 2;
    .level[5] 2;
    .level[6] 2;
    .level[7] 2;
  }

  child pushbutton Pb_Exit
  {
    .text "Exit";
    on select
    {
      exit();
    }
  }

  child statictext St2
  {
    .xleft 355;
    .ytop  71;
    .text  "no value";
  }

  child pushbutton Pb
  {
    .xleft  226;
    .width  247;
    .ytop   16;
    .height 28;
    .text   "Count staff working in a company";
    on select
    {
      St2.text := itoa(Tv:childcount(Tv.activeitem, 1));
    }
}