//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "GetPrevChild.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
// BeginExample: GetPrevChild
// Property: ComCtrls.TTreeNode.Parent
// Method: ComCtrls.TTreeNode.GetNextChild
// Method: ComCtrls.TTreeNode.GetPrevChild

// BeginCode
/*
The following code tests to see if the currently selected
item has a sibling; if so, HasSibling will be set to true.
*/
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";
}
// EndCode
// EndExample: GetPrevChild
//---------------------------------------------------------------------------
