On Friday, February 21, 2003, at 01:43 PM, Sherm Pendley wrote:


On Friday, February 21, 2003, at 11:53 AM, Dan Mills wrote:

When creating a new window controller, it runs:

$self->{Window}->registerForDraggedTypes (NSArray->arrayWithObjects ("NSFilenamesPboardType"));

Good so far...


I also define this method in the window controller:

... which isn't where that method needs to be. The NSDraggingDestination protocol methods must be implemented by the object that's been registered - in this case, an NSWindow object.

That is very unfortunate. Would it be easy to subclass it in objc and just add a stub that calls a perl function? (or am I better off just waiting for the next CB? I'm not in a crazy hurry to get DND).


Also, on the topic of DND, how do I catch a file drag to the dock icon?

That's an entirely different kettle of fish.

Yeah, that's what I thought.


The Finder handles the D&D aspect of that itself, and simply forwards a request to open the dropped documents to the application. Wil Sanchez' DropScript application is a good example of handling it in Objective-C - some time soon, I'd like to get around to a similar example in Perl.

Are you sure I don't need to subclass for that?


I haven't read DropScript (I don't have an apple cvs login), but I looked around on google and found that I needed to add the accepted type(s) to the CFBundleDocumentTypes info.plist entry.

After doing this, I can now drag files of the correct type to the dock icon, and it "accepts" them (they icon greys out to indicate a drop there would be acceptable), but nothing happens when I actually do the drop.

I also read that the function called is application:openFile. I had openDocument () defined in MyApp.pm, which File->Open calls w/o problems. I added openFile () in MyApp.pm as well, but still nothing happens.

Thanks for all the good info!
-Dan



Reply via email to