GetHitTestInfoAt (C++)

From RAD Studio Code Examples
Jump to: navigation, search

Description

The following code checks a list of htHitTest types and adds the ones that occur when the mouse is pressed while on the tree view.

Code

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");
}

Uses