Hi Laurant, Thanks a lot for your reply. And perhaps I misspoke somewhat - I'm not trying to implement full drag and drop within my application, but only receive simple filename drop events that originate from outside the application. I think that it's just a matter of adding a few extra delegate mappings, but I don't understand how to "extend" more mappings into the hotcocoa wrapper classes. Perhaps instead I will try to build from source and add the mappings there, and use a local build to test with. If a miracle occurs and I can figure it out, I will submit a patch. :-) Thanks again! Jeff On Mon, Mar 16, 2009 at 1:02 PM, Laurent Sansonetti <lsansonetti@apple.com>wrote:
Hi Jeff,
(Sorry for the late reply.)
On Mar 14, 2009, at 9:09 PM, Jeff Cohen wrote:
Hello,
I'm just getting started with MacRuby and HotCocoa (was a longtime .NET developer, and wasn't interested in learning Cocoa until MacRuby came along). I have a simple HotCocoa app with just a table view, and I'd like the user to be able to drop a filename from the Finder onto the table view (or anywhere in my app). I can call registerForDraggedTypes() on my table view object successfully. But I'm not sure how to have events delegated to my Application class (or if that's even possible).
Looking at the hotcocoa source for wrapping NSView (view.rb), I don't see delegate mappings for the draggingEntered or performDragOperation events. I think I need to do something like the mapping code does and write code like this:
delegating "draggingEntered", :to => :dragging_entered
but I don't know where I can or should do that, or if I'm even on the right track.
Any hint of where I should get started would be appreciated.
I don't think HotCocoa exposes drag and drop facilities yet. In general drag and drop in Cocoa is non trivial to do (esp. if you want to integrate it with complex views such as NSTableViews).
The following article describes how to implement drag and drop in Cocoa:
http://developer.apple.com/documentation/Cocoa/Conceptual/DragandDrop/Dragan...
It even has a special section dedicated to NSTableViews.
You should be able to do everything described in this article using "pure" MacRuby code but if you want to use some kind of syntax sugar via HotCocoa I'm afraid you will have to wait until someone implements them.
HTH, Laurent _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel