Drag and Drop in the Browser Plugin doesn't work


#1

I just tried playing with the browser plugin demo and tried to get drag and drop working. I tried both Component::filesDropped and deriving the demo plugin from FileDragAndDropTarget. Neither worked. To verify I was implementing drag and drop correctly I created a simple component and tried it. Component::filesDropped didn’t work, but deriving from FileDragAndDropTarget did work. As for the plugin, it appeared interested in the dragged files (image turned into plus sign), but neither FileDragAndDropTarget::isInsterestedInFileDrag, FileDragAndDropTarget::dragEnter, nor FileDragAndDropTarget::filesDropped were invoked.

What is posting the “interested in files” image? Also, won’t the browser sandbox prevent drag and drop from working? For example, from IE, you can’t drag files onto a desktop application. Any ideas are appreciated.

BTW: I’m using Juce vintage 03 Dec 09 running on Windows XP and tried the plugin with both IE 7 and Firefox.


#2

I haven’t tried drag and drop in a browser plugin, but since the browser’s in control of the window, it’s could easily be messing up the registration of the drag and drop target somehow… Sounds like a tricky one to debug and I’m a bit busy on other stuff at the moment.


#3

Hi, i’m in the process of trying to update my juce installation from 1.44 to 1.5 (latest), but am having trouble with the new drag-and-drop api. i’m using juce’s ResizableWindow to hold a xulrunner window, and I want to receive files dropped either from the OS (Windows) or iTunes. in 1.44 I simply have the xulrunner window’s juce wrapper extend from Component, and its filesDropped() callback gets called when I drop iTunes tracks or files into my juce/xulrunner app. But with 1.5 I simply do not receive any drag-and-drop callback at all.

I made sure my top-level container extends DragAndDropContainer, and I tried both subclassing from DragAndDropTarget and FileDragAndDropTarget (one at a time) but nothing ever worked. Could it be because my top-level window is a ResizableWindow? Can a ResizableWindow be a DragAndDropContainer at the same time or should I just make one of the ResizableWindow’s child components a DragAndDropContainer (that’s still a parent of the component that should receive a drop callback).

I wonder what was changed between 1.44 and 1.50 that might cause drag-and-drop to stop working for me? More than the interface must’ve changed. We really want to upgrade to the latest juce to get all the fixes and improvements, but this one function is holding us back. Any help would be highly appreciated!

will


#4

Can’t think of anything in particular, though it’s been so long since 1.44 that most of the code has probably changed! Check the exact signature of Component::filesDropped, because maybe the parameters have changed and you’re no longer actually overloading it? It certainly doesn’t matter what type of component you’re using.


#5

Actually I tested this when 1.46 came out and drag-n-drop didn’t work for me then either. I guess I’ll dive in to see what the differences are.

Also is it “legal” to make a DragAndDropContainer also a FileDragAndDropTarget? if not then is it ok to make the top-level app window (ResizableWindow in this case) the DragAndDropContainer or should I make its child content component the DragAndDropContainer?


#6

Sure, I can’t think of a reason why that’d be a problem.


#7

Sure, I can’t think of a reason why that’d be a problem.[/quote]

Jules, i finally got some time to dig in, and i think i know what’s going on. we’re embedding mozilla xulrunner in a JUCE window, and xulrunner also implements the IDropTarget api just as the latest JUCE does, and it looks like xulrunner is processing the files dropped event. i can work around this by listening for the files dropped windows message in the top window as before, but we’re looking into if there’s a way to make xulrunner pass up the drop events to us first. Just thought i post this in case other users are seeing this.

will


#8