• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Custom drag image for NSTableView selections
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom drag image for NSTableView selections


  • Subject: Re: Custom drag image for NSTableView selections
  • From: Graham Cox <email@hidden>
  • Date: Fri, 12 Jul 2013 11:49:41 +1000

On 12/07/2013, at 10:35 AM, email@hidden wrote:

> However, based on the way I have simply put the row selection indexes NSIndexSet into NSData and into the pasteboard, the API as I see it at the moment (using NSDraggingSession property draggingFormation ) may not work for me without some additional work.
>
> I wasn't really wanting to put the represented objects of my rows on to the pasteboard, since NSView and NSTableView do a lot of the dragging API work already, it may have to be a feature I handle later, it looks like a lot of work for now, and the API seems spread out amongst a lot of different classes I am not familiar with… :(


Is the drag expected to work between different apps or simply within your own app?

If the latter, there is no reason to put anything on the pasteboard other than enough dummy data to identify the drag (usually your private drag type and an empty string are enough). When you start the drag, put the real data somewhere accessible, such as a class method. When you receive the drag and identify it as this private type, use the class method to get the data. That data can be the original index set for example (though as far as I can see there's nothing to stop you putting the index set on the pasteboard directly, not sure why you need to convert to NSData).

The point is that the drag APIs standardise the visual side of the process, but do not force you to use the data side of the process unless the objective is to pass data between apps. Particularly for table reordering or dragging in and out of tables, it's often much easier to bypass the data side of the drag manager. Putting your actual objects on the pasteboard is a waste of time, since they're only going to be converted back again in a different place within the same app.

--Graham


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Custom drag image for NSTableView selections
      • From: email@hidden
References: 
 >Custom drag image for NSTableView selections (From: email@hidden)
 >Re: Custom drag image for NSTableView selections (From: Graham Cox <email@hidden>)
 >Re: Custom drag image for NSTableView selections (From: email@hidden)

  • Prev by Date: Re: iOS reachability
  • Next by Date: Re: Custom drag image for NSTableView selections
  • Previous by thread: Re: Custom drag image for NSTableView selections
  • Next by thread: Re: Custom drag image for NSTableView selections
  • Index(es):
    • Date
    • Thread