仅通过拖动和移动放入 Flex 树中 [英] Move-only with drag & drop in a Flex tree

查看:29
本文介绍了仅通过拖动和移动放入 Flex 树中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一棵树(在 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 中的 dragEnterHandlerdragOverHandlerdragDropHandler 函数,由于所有内容都受到保护且非常简单,为了不显示复制反馈,也不允许用户通过拖动进行复制:

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屋!

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