Click here to Skip to main content
15,881,839 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I have a program in delphi (7 and 2010) with win32 treeview control. How can I add an action to my node?
For example:
I want to play mp3 file when i select node in my treeview.
or
like windows explorer, where if click on a file in left pan, it shows action in right pan.

Thank you
Posted
Updated 19-Jul-10 5:09am
v2

1 solution

You should check in the OnClick event if the click was realy on an icon. Below an example.

SQL
procedure TForm1.TreeView1Click(Sender: TObject);
var
  P:TPoint;
begin
  GetCursorPos(P);
  P := TreeView1.ScreenToClient(P);
  if (htOnStateIcon in
             TreeView1.GetHitTestInfoAt(P.X,P.Y)) then
    ToggleTreeViewCheckBoxes(
       TreeView1.Selected,
       cFlatUnCheck,
       cFlatChecked,
       cFlatRadioUnCheck,
       cFlatRadioChecked);
end;


Good luck!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900