pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marco Castillo <mabcasti...@gmail.com>
Subject Re: Drag and Drop using a TreeView as the DropTarget
Date Wed, 16 Mar 2011 14:12:29 GMT
Thanks to both, it works like a charm!!


On Wed, Mar 9, 2011 at 7:01 PM, Greg Brown <gk_brown@verizon.net> wrote:

> The coordinates should be in the coordinate space of the tree view.
> G
> ----- Reply message -----
> From: "Chris Bartlett" <cbartlett.x@gmail.com>
> Date: Wed, Mar 9, 2011 3:38 pm
> Subject: Drag and Drop using a TreeView as the DropTarget
> To: <user@pivot.apache.org>
> Marco,
> You can determine the path to the tree view node at a given y position with
> http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/TreeView.html#getNodeAt(int)<http://pivot..apache.org/2.0/docs/api/org/apache/pivot/wtk/TreeView.html#getNodeAt(int)>
> When the drop occurs you are provided x and y coordinates
> http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/DropTarget.html#drop(org.apache.pivot.wtk.Component,
> org.apache.pivot.wtk.Manifest, int, int, int,
> org.apache.pivot.wtk.DropAction)
> If for some reason the y coordinate from doesn't seem right, you  might
> need to use one of the mapPointToAncestor / mapPointFromAncestor methods on
> Component.  (It will probably be OK, but I am not in a position to check
> right now)
> http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/Component.html#mapPointToAncestor(org.apache.pivot.wtk.Container,
> int, int)
> Chris
> On 10 March 2011 03:06, Marco Castillo <mabcastillo@gmail.com> wrote:
>> Dear List:
>> We have a split pane, in the left part of the pane there is a tree view
>> with directories, in the right pane there is a TableView with the file
>> detail for each directory. Each node and branch of the tree represents
>> directories. A node is a directory without directories within. We implement
>> a drag and drop feature using the TableView as the source and the TreeView
>> as the target. The drag and drop functionality will move a file from its
>> current directory to another (the one selected in the source). The drag
>> source functionality works quite well, but in the target functionality we
>> found a problem. The problem is that when we drop the item within the tree,
>> we can't correctly choose the selected branch or node we want to drop the
>> dragged item. How can we found which is the branch or node within the
>> TreeView that is selected by the mouse when we hover over the TreeView? Is
>> there a way that we can define a single branch or node as a drop target?
>> Any help will be greatly appreciated.
>> Regards
>> Marco

View raw message