GetPrevChild (C++)

From RAD Studio Code Examples
Jump to: navigation, search

Description

The following code tests whether the currently selected item has a sibling; if so, HasSibling is set to True.

Code

void __fastcall TForm1::Button1Click(TObject *Sender)
{
TTreeNode *SelNode = TreeView1->Selected;
TTreeNode *ParentNode = SelNode->Parent;
bool HasSibling = (ParentNode->GetPrevChild(SelNode) ||
				   ParentNode->GetNextChild(SelNode));
  if (HasSibling) Edit1->Text = "True";
  else Edit1->Text = "False";
}

Uses

Personal tools
Assistance