2.29 :parent()

This method is used to query the parent of an element within the treeview object.

Definition

integer :parent
(
  integer Index input
)

Parameters

integer Index input
In this parameter the index of the element whose parent is to be calculated is specified.

Return value

0
no valid element specified
others
index of parent in tree

Objects with this method

treeview

Example

window Wn
{
  .title "Example for method :parent()";
  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;
    integer Index;
  }
  child statictext St
  {
    .text "No value";
  }
  child pushbutton PbPar
  {
    .text "Define company of a person";
    on select
    {
      if (Tv:parent(Tv.activeitem) = 0) then
        St.text := "Please select person";
      else
        St.text := Tv.content[Tv:parent(Tv.activeitem)];
      endif
    }
  }
}