Mike Depies
Mike Depies

Reputation: 817

SWT Droptarget overlap issues

I have a general drop target area for a specific transfer. The control that the drop target is on is a composite. Inside the composite I have a multitude of things. I recently added drop target to one of these objects inside of the composite. I've now run into an issue with the swt drag and drop, when I enter the first overall drop target, it behaves like one would expect. However, when I enter into the second drop target, that is nested within the original, it triggers a leave of the first target and an enter on the second one. This is causing all sorts of issues. Any idea on how to avoid this? Thanks.

Upvotes: 1

Views: 166

Answers (1)

sharakan
sharakan

Reputation: 6901

I believe there can only be one 'active' drop target at a time, so I'm fairly sure that you can't make it not leave your composite.

But I think what you're trying to do may be possible. To summarize, if you're dragging an object with type A, you want to be able to drop it anywhere in the composite. If you have an object with type B, it should only be able to drop in the sub-component.

If so, how about this: Let the sub component handle objects of both type A and B. But if it gets a drop of type A, it forwards the event to it's parent.

Upvotes: 2

Related Questions