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

#include <vcl.h>
#pragma hdrstop

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

// BeginCode
/*
The following code checks a list of htHitTest types and adds
the ones that occur when the mouse was pressed while on the
tree view.
*/
void __fastcall TForm1::TVMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift,
          int X, int Y)
{
  THitTests MyHitTest = TV->GetHitTestInfoAt(X,Y);
  if (MyHitTest.Contains(htNowhere))
    ListBox1->Items->Add("Nowhere");
  if (MyHitTest.Contains(htOnItem))
    ListBox1->Items->Add("OnItem");
  if (MyHitTest.Contains(htOnButton))
    ListBox1->Items->Add("OnButton");
  if (MyHitTest.Contains(htOnIndent))
    ListBox1->Items->Add("OnIndent");
  if (MyHitTest.Contains(htOnLabel))
    ListBox1->Items->Add("OnLabel");
  if (MyHitTest.Contains(htOnRight))
    ListBox1->Items->Add("OnRight");
  if (MyHitTest.Contains(htAbove))
    ListBox1->Items->Add("Above");
  if (MyHitTest.Contains(htBelow))
    ListBox1->Items->Add("Below");
  if (MyHitTest.Contains(htOnIcon))
    ListBox1->Items->Add("OnIcon");
  if (MyHitTest.Contains(htOnStateIcon))
    ListBox1->Items->Add("OnStateIcon");
  if (MyHitTest.Contains(htToLeft))
    ListBox1->Items->Add("ToLeft");
  if (MyHitTest.Contains(htToRight))
    ListBox1->Items->Add("ToRight");
}
// EndCode
// EndExample: GetHitTestInfoAt
//---------------------------------------------------------------------------
