PDA

View Full Version : How can I know when a drag starts from a grid?



Jonathan Feinberg
23 Apr 2007, 9:54 AM
The subject says it all.

The GridView doesn't hold on to a reference to its GridDragZone; even if it did, the GridDragZone overrides onInitDrag so that it no longer calls onStartDrag.

How can I be informed when someone has started dragging something out of my Grid?

sonic64
23 Apr 2007, 11:52 AM
Well, you can only drag and drop to the same grid.

Jonathan Feinberg
23 Apr 2007, 12:27 PM
Well, you can only drag and drop to the same grid.
Not true. Case in point: in my application, I drag from a grid into a tree, and onto some arbitrary divs.

tryanDLS
23 Apr 2007, 12:36 PM
Just guessing here by looking at the source. It looks like DragSource.onStartDrag is just an interface function that you can override to do whatever you need.

Jonathan Feinberg
23 Apr 2007, 12:40 PM
Just guessing here by looking at the source. It looks like DragSource.onStartDrag is just an interface function that you can override to do whatever you need.

Yes, and if the grid's DragSource were accessible, that would be a handy fact to know. But, as I took care to point out in the original post, it's not.

I've worked around this problem by configuring the grid as not draggable, and then adding a custom GridDragZone by hand, overriding its onDragInit method, essentially duplicating library code. I'm hoping that's not necessary.