Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Does deprecated Drag Manager API SetDragItemFlavorData() stillwork with "typeFileURL" flavor type on Leopard OS?




On 9 Apr 2008, at 18:04, Steve Mills wrote:
Pardon me if I branch this thread a bit, but this brings up a question. What is the purpose of allowing multiple *items* in a drag vs. using multiple flavors? We always create 1 item with multiple flavors, and I don't recall ever seeing a multi-item drag from any other source I've used.


Historically (i.e Drag Manager), each drag item should represent a single entity being dragged (e.g one for each item in a table being dragged or an individual file or a shape in a drawing package etc), while multiple flavors are used to provide different representations of the data for each item.

Unfortunately, the waters have been muddied by Cocoa's pasteboard scheme, whereby multiple items are usually added as a single array of items of a certain type and alternate representations are other arrays/ types. This makes it hard to drag multiple different kinds of objects with different alternate representations for each (since you need a way to map the nth item in one array to the yth item in another).

As an example, consider dragging 2 urls, whereby the 1st is an http and 2nd is a local file.

The Drag Manager way would be to add two items. Item 1 would have a URL flavor and a text version. Item 2 would have URL, text AND a file flavor for apps that don't know how to deal with URLs, but know about files.

The Cocoa way would be to add 3 'flavors' - one containing an array with the 2 urls, one with maybe the text of the two URLs combined into a string, and one with an array of the single file being dragged.

The problem with the cocoa way is that it becomes very difficult for an app to follow the 'only accept the drop if each item can be accepted guideline'. In our example, an app that knows how to receive only files has no way to know if the sending app was really sending just one file with two alternate representations (URLs and text) or if the drag contained multiple distinct items.

In practice, this doesn't usually affect many apps, as the kind of items being dragged in a single action are usually all of the same type.

Matt Gough
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden
References: 
 >RE: Does deprecated Drag Manager API SetDragItemFlavorData() stillwork with "typeFileURL" flavor type on Leopard OS? (From: "Guangxing Li" <email@hidden>)
 >Re: Does deprecated Drag Manager API SetDragItemFlavorData() stillwork with "typeFileURL" flavor type on Leopard OS? (From: "Steve Mills" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.