GetHitTestInfoAt (Delphi)

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 button was clicked while on the tree view.

Code

procedure TForm1.TVMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var
  MyHitTest : THitTests;
begin
  MyHitTest := TV.GetHitTestInfoAt(X,Y);
  if htNowhere in MyHitTest then
    ListBox1.Items.Add('NoWhere');
  if htOnItem in MyHitTest then
    ListBox1.Items.Add('OnItem');
  if htOnButton in MyHitTest then
    ListBox1.Items.Add('OnButton');
  if htOnIndent in MyHitTest then
    ListBox1.Items.Add('OnIndent');
  if htOnLabel in MyHitTest then
    ListBox1.Items.Add('OnLabel');
  if htOnRight in MyHitTest then
    ListBox1.Items.Add('OnRight');
end;

Uses

Personal tools
Assistance