Win32中的TreeView和DragAndDrop [英] TreeView and DragAndDrop in Win32

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

问题描述

我有一个使用TreeView控件的Win32 C ++(非MFC)应用程序.该控件是使用设置的TVS_DISABLEDRAGDROP样式创建的.我的期望是,在这种情况下,我将收到TVN_BEGINDRAG通知,并且可以处理来自该处理程序的拖动操作. (此外,它过去一直有效-几年来它一直是已发布产品代码的一部分,直到最近才运行良好.在某些时候,情况有所变化.)

现在,我再也没有收到TVN_BEGINDRAG消息.我可以使用树项目作为拖动的来源,但要这样做,我需要在鼠标按下处理程序中而不是在TVN_BEGINDRAG处理程序中检测拖动.

谁能解释为什么会这样吗?尽管我有一个解决方法,但我想了解为什么需要这种解决方法.

谢谢.

里克·奥尔巴赫
奥巴赫Associate,Inc.

I have a Win32 C++ (non-MFC) application which uses a TreeView control. The control is created with the TVS_DISABLEDRAGDROP style not set. My expectation was that in this case I would receive a TVN_BEGINDRAG notification and could handle the drag operation from that handler. (Moreover, this used to work -- it has been part of released product code for several years and worked fine until recently. At some point, something changed.)

Now, I never receive a TVN_BEGINDRAG message. I am able to use a tree item as the source of a drag, but to do so, I need to detect the drag inside my mouse-down handler, instead of in the TVN_BEGINDRAG handler.

Can anyone explain why this might be the case? Although I have a work around in place, I would like to understand why this work-around is necessary.

Thank you.

Rick Aurbach
Aurbach & Associate, Inc.

推荐答案

Sergey,

感谢您的快速响应,但是支持文章中显示的解决方案并没有太大帮助.由于通知永远不会发生,因此永远不会设置g_fdragging标志,因此无法使其他处理程序中实现的逻辑起作用.

我基本上是使用与程序其他地方相同的方法来处理其他拖动逻辑. (此树形视图只是许多不同类型的对象之一,它们可以是拖动源或目标,也可以是两者.)我对适当处理程序的实现工作有所不同,但实现了与支持文章中的代码相同的目的. br/>
这仍然使问题悬而未决-为什么我没有收到通知?

里克
Sergey,

Thanks for your rapid response, but the solution shown in the support article doesn''t help much. Since the notification never happens, there''s the g_fdragging flag never gets set, so there''s no way for the logic implemented in the other handlers to work.

I''m basically handling the other drag logic using the same methodology I use everywhere else in my program. (This tree view is only one of many different types of objects which can be either drag sources or targets or both.) My implementation of the appropriate handlers works a bit differently, but accomplishes the same purposes as the code from the support article.

This still leaves the question open -- why don''t I get the notification??

Rick


这篇关于Win32中的TreeView和DragAndDrop的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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