
(*
 Delphi Object and Component Reference
#{bmc bm9.BMP} GetHitTestInfoAt example
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::TreeView1MouseDown(TObject *Sender, TMouseButton!AL(`tmousebutton_type',1,`TopicNotFound',`main') Button, TShiftState!AL(`tshiftstate_type',1,`TopicNotFound',`main') Shift, int X, int Y)
{
  THitTests MyHitTest = TreeView1->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");
}
 
