检查 Win32 树视图项会自动检查所有子项 [英] Checking a Win32 Tree View Item Automatically Checks all Child Items

查看:42
本文介绍了检查 Win32 树视图项会自动检查所有子项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Win32 API 和 MS Visual C++ 6 来构建目录结构的树视图,并带有与每个树视图项关联的复选框.我的目标是能够检查父文件夹,并自动检查其所有关联的子文件夹.

I am using the Win32 API and MS Visual C++ 6 to build a tree view of a directory structure, with check boxes associated with each tree view item. My goal is to be able to check a parent folder, and have that automatically check all of its associated children.

然而,在通过 MSDN 挖掘之后,我一直无法找到正在检查的项目的控制通知消息,只有当一个项目被选择时.我曾考虑使用选择通知消息来提示程序轮询项目并查看其当前的检查状态"是否为真,但我不确定 checkedselected 可以通过这种方式联系在一起,而且我还担心当用户在一个非常大的目录中移动时不断轮询项目相关的开销.

However, after digging through MSDN, I have not been able to find a control notification message for an item being checked, only when an item is selected. I have considered using a selection notification message to prompt the program to poll the item and see if its current 'check state' is true, but I am not sure that checked and selected can be tied together in such a way, and am also concerned about the overhead associated with constantly polling items as a user moves through a very large directory.

有没有人有设置这个场景的经验?我对轮询 GUI 元素的开销的担忧是否合理?

Has anyone had experience setting up this scenario? Are my concerns about the overhead of polling a GUI element justified?

推荐答案

没有任何通知.不过你可以自己写.只需处理鼠标点击并使用hittest查看鼠标光标是否在状态图像上.为了完整起见,请处理空格键并为所选项目发送相同的通知.

There isn't any notification. You can write your own, though. Just handle mouse click and use hittest to see if the mouse cursor is on the state image. For completeness handle the space key and send the same notification for the selected item too.

这篇关于检查 Win32 树视图项会自动检查所有子项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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