Recent

Author Topic: retrieve ttreeview item under the mouse when moved over an item  (Read 655 times)

aducom

  • Full Member
  • ***
  • Posts: 162
    • http://www.aducom.com
Is it possible that when the mouse goes over a ttreeview to retrieve the current item under the mouse? I would like to display a hint text, depending on the item the mouse is over.

wp

  • Hero Member
  • *****
  • Posts: 13266
Re: retrieve ttreeview item under the mouse when moved over an item
« Reply #1 on: April 10, 2023, 12:00:06 am »
Use the TTreeView method GetNodeAt(x, y):

Code: Pascal  [Select][+][-]
  1. procedure TForm1.TreeView1MouseMove(Sender: TObject; Shift: TShiftState;
  2.   X, Y: Integer);
  3. var
  4.   node: TTreeNode;
  5. begin
  6.   node := TreeView1.GetNodeAt(X, Y);
  7.   if node <> nil then
  8.     Caption := node.Text
  9.   else
  10.     Caption := '';
  11. end;

aducom

  • Full Member
  • ***
  • Posts: 162
    • http://www.aducom.com
Re: retrieve ttreeview item under the mouse when moved over an item
« Reply #2 on: April 10, 2023, 08:15:10 pm »
Tnx!

 

TinyPortal © 2005-2018