Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drag & Drop both ways



At 16:45 -0800 18/11/02, Glen Fisher wrote:

Rolf Howarth wrote:
|[H]ow do I stop dragging files onto myself?? If I initiate a drag
|inside my window but then cancel it by releasing the button without
|leaving the window I still receive an incoming drag as if I'd dragged
|the file in from the Finder!

I suspect by checking the source of the drag, and ignoring the drop if the source and targets are the same.

At 16:45 -0800 18/11/02, Vladimir Lhotak <email@hidden> wrote:

In this case your dropTarget's dragEnter() method shouldn't accept the drag
if dragSource == dropTarget. Now, I don9t think you can get at the
dragSource from the DropTargetDragEvent (the parameter to dragEnter()). But
you could use DragSourceListener to keep some state when it does dragging
and check this state in your component's dragEnter().

That's right, the source of the DropTargetDragEvent that dragEnter gets is a DropTargetContext, which doesn't tell you where the drag originated. In the end I had to do something along the lines you suggested, look at all the events I receive both as a drag originator and as a recipient, trying to work out which sequence indicates a self-drag. This seems like a horrible hack for something very obvious I'd have thought you want to know. Perhaps it is just a huge defect in Sun's API - it wouldn't be the first.

> 2. When receiving multiple files from the Finder I get a
java.util.List containing File objects. However, when I try to send
multiple files the same way it's ignored. I can only ever send a
single file, using a serialised java.io.File (as opposed to a
java.util.List) in my Transferable.

Any ideas? This is 1.3.1 under 10.2.2 by the way.

In all likeliness just a bug, and one that's not very likely to get fixed on
1.3.1. It would be worth trying if 1.4.1 will work for you - if not we'll
jump on it.

Well, unless and until QTJava works with 1.4.1 I will be unable to try that out, so that's a non-solution for me. (Ditto for the myriad other bugs I've raised in the past which ADC have now asked me to test in 1.4.1)

Thanks anyway for the suggestions,

-Rolf
--
Rolf Howarth, Square Box Systems Ltd, Stratford-upon-Avon UK.
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Be sure to read the FAQ http://developer.apple.com/java/faq/ before posting
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.