Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mdeh

macrumors 6502
Original poster
Jan 3, 2009
345
2
Hi all,
Could I ask the group this.


I am doing the "With and without" bindings tutorial of Apple, which includes Drag and drop. But, I noticed that many(?) cocoa controls already seem to implement this natively. So, for example, NSTextfield seems to allow a drop...without anything implemented. What am I missing? Hope this does not sound too silly. Or... In other words, what is there to gain by actually implementing the drag and drop methods in an application.

Thanks in advance.
 
Text fields aren't as great of an example since you almost exclusively deal with text and they already support drag/drop of text, but if you wanted to accept dropping of an RTF file to insert the RTF contents, you'd have to handle that through a custom drag/drop.

Another example is allowing the user to drop a file onto your window/view to start some sort of processing on it. There is no way to do that out of the box. You'd have to override some NSView methods and handle the complete drag/drop operation yourself.

Or, say you have a list of files in a table view that represent some internal data. To allow the user to drag these items to the Finder to create new text files would require custom drag/drop handling.

Just a few examples :)
 
Text fields aren't as great of an example since you almost exclusively deal with text and they already support drag/drop of text, but if you wanted to accept dropping of an RTF file to insert the RTF contents, you'd have to handle that through a custom drag/drop.

Another example is allowing the user to drop a file onto your window/view to start some sort of processing on it. There is no way to do that out of the box. You'd have to override some NSView methods and handle the complete drag/drop operation yourself.

Or, say you have a list of files in a table view that represent some internal data. To allow the user to drag these items to the Finder to create new text files would require custom drag/drop handling.

Just a few examples :)


Thanks Kainjow...always to the rescue!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.