仅通过拖动和移动放入 Flex 树中 [英] Move-only with drag & drop in a Flex tree
问题描述
我有一棵树(在 Flex 3.5 中),我想使用拖动 &删除功能,但我想让用户只移动节点,而不是复制它们.我尝试侦听 dragOver 事件并更改拖动事件的 action 属性(如果它指示复制操作),还侦听 keyDown 事件并在按下的键为 ctrl 时使用 DragManager 更改反馈,但无济于事.
I have a tree (in Flex 3.5), and I want to use the drag & drop functionality, but I want to let the user only move nodes, not copy them. I tried listening for the dragOver event and change the drag event's action property if it indicates a copy operation, and also listening for the keyDown event and changing the feedback using the DragManager if the pressed key was ctrl, but to no avail.
有人有别的想法吗?谢谢.
Does anybody have another idea? Thanks.
推荐答案
您可以覆盖 Tree 中的 dragEnterHandler
、dragOverHandler
和 dragDropHandler
函数,由于所有内容都受到保护且非常简单,为了不显示复制反馈,也不允许用户通过拖动进行复制:
You can override dragEnterHandler
, dragOverHandler
and dragDropHandler
functions in Tree, since all are protected and quite simple, in order not to show copy feedback and not to allow user to copy via drag:
override protected function dragEnterHandler(event:DragEvent):void
{
// ...
}
override protected function dragOverHandler(event:DragEvent):void
{
// ...
}
这篇关于仅通过拖动和移动放入 Flex 树中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!