PDA

View Full Version : Create Draggable for a TreeItem


cdasher
05-02-2008, 10:28 AM
What is the best way to create a Draggable from a tree (using TreeViewer) to do drag and drop. From previous posts (in old forum) I think I need to detect drag event (not sure you to do this from an item in the tree) then create a copy (since the icon and text is what I need, I guess I just create a ContentPanel and add the icon and text to it) then drag it to where I am and when dragt stop event fires (I assume when you stop dragging) I somehow find out what is under the mouse, do validation whatever, inform user that the drop is available, and then on mouse release, do something to show the drop has occured (like add icon to a datalist etc.) So the question is how do I get the drag event from a TreeItem in a Tree, I cannot seem to figure out what kind of Event (Tree or Component) to listen for or even if this is possible)

darrellmeyer
05-02-2008, 02:27 PM
You would want to make the entire tree draggable. When a drag begins you would need to find the tree's current selection, and create a drag proxy based on the selected item.

cdasher
05-02-2008, 02:39 PM
Thanks I'll try that.

cdasher
05-05-2008, 05:34 PM
When I make the tree draggable (just startingt to implement) the entire tree drags and I cannot expand the tree . Should I cancel the drag event, if so how in order to get the tree to expand?

cdasher
05-05-2008, 05:38 PM
Also I lose my right mouse click for context menu. When I click anywhare on the tree left or right the drag stat event is fired.