树形动作 [英] Treeview action

查看:186
本文介绍了树形动作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我有一个带有Win32 Treeview控件的Delphi(7和2010)程序.如何向我的节点添加动作?
例如:
在树形视图中选择节点时,我想播放mp3文件.

就像Windows资源管理器一样,如果单击左平移中的文件,则会在右平移中显示操作.

谢谢

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

推荐答案

您应该检查OnClick事件是否确实是在图标上单击.下面是一个例子.

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

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!


这篇关于树形动作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆