1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Question about Drag and Drop

Discussion in 'Mac Programming' started by mdeh, Oct 27, 2009.

  1. macrumors 6502

    #1
    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.
     
  2. Moderator emeritus

    kainjow

    #2
    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 :)
     
  3. macrumors 6502

    #3

    Thanks Kainjow...always to the rescue!
     

Share This Page