2 Replies Latest reply on Feb 5, 2011 1:48 PM by cloudguitar

    Disabling copy action for List

    cloudguitar Level 1

      Hey all,

       

      I have been trying to disable the copy action for the Spark List component (I need only move, copy does not make sense for my application), but I really have no idea how to do it without manually reimplementing drag and drop.

       

      Initially I thought I could set a dragEnter handler which checked event.action and called event.preventDefault().

      However, event.action seems to be set incorrectly to DragHandler.MOVE even if the item is being copied (dragged with Ctrl pressed),

      so that didn't work. Similarly, seems like event.ctrlKey is never set correctly for a DragEvent, so I can't poll that to prevent the user from copying either.

       

      I also figured out I could add a keyDown handler to the Application to set a flag when Ctrl is pressed that I can use to block dragging when Ctrl is down. Unfortunately, this doesn't quite work because a user could press Ctrl while the browser has the focus, and give the focus to the flex app by starting a d'n'd operation.

       

      I don't think there is a way to check whether a key is down at a given point in time, so I am really out of ideas. Any help would be greatly appreciated.

       

      Claudio