Skip navigation.
 
mlRe: Re: Drag to Finder and create a file
FROM : The Karl Adam
DATE : Mon Apr 11 19:24:46 2005

There is plenty of documentation on HFS Promise drags, the problem
your running into is that Cocoa doesn't have the most complete
documentation for it.
The reason I didn't provide you with code in the first place was in
order to not deflect from the many discussions already on this topic
that I and other have provided info in.

So for posterity, here are the links to the info about this:
1) TechNote 1085(Using the Drag Manager to Interact with and
Manipulate File System Entities):
http://developer.apple.com/technotes/tn/tn1085.html
2) PasteBoard Reference:
http://developer.apple.com/documentation/Carbon/Reference/Pasteboard_Reference/index.html?http://developer.apple.com/documentation/Carbon/Reference/Pasteboard_Reference/paste_ref/chapter_1.2_section_2.html
3) Cocoa-dev discussions:
http://cocoa.mamasam.com/COCOADEV/2003/03/2/59716.php
http://lists.apple.com/archives/cocoa-dev/2004/Dec/msg01122.html

-Karl

On Apr 11, 2005 11:24 AM, Tim Hewett <<email_removed>> wrote:
> Lorenzo,
>
> See here for Apple's documentation:
>
> http://developer.apple.com/documentation/Cocoa/Conceptual/DragandDrop/
> Tasks/DraggingFiles.html#//apple_ref/doc/uid/20001288/102943
>
> It's fiddly and convoluted, but once you've got it working you can
> forget
> about it.
>
> Tim.
>
>
> On 11 Apr 2005, at 15:38, <email_removed> wrote:
>
> > Yes, thank you,
> > but how to implement "promised drags" properly?
> > I am getting crazy with that. There is no documentation about it.
> > The Cocoa Drag and Drop methods are something opaque so the only way
> > to make
> > it work is to understand the mechanism. To know how to use any single
> > API.
> > Instead, nothing, Apple think that we developers have magic powers...
> >
> > Looking at some code I have found on the web it seems that I need to
> > add
> >
> >    dragPromisedFilesOfTypes:
> >
> > within the
> >
> >    - (BOOL)outlineView:(NSOutlineView*)olv writeItems:(NSArray*)items
> >    toPasteboard:(NSPasteboard*)pboard
> >
> > So I did that and now the only place I can write the item data to a
> > file in
> > the Finder, seems to be within
> >
> > -(NSArray*)namesOfPromisedFilesDroppedAtDestination:
> > (NSURL*)dropDestination
> > {
> >    // ...
> >    NSData      *itemData = [selectedItem GetItemData];
> >    NSString    *filename = [[dropDestination path]
> >                stringByAppendingPathComponent:[selectedItem
> > objectName]];
> >
> >    [itemData writeToFile:filename atomically:YES];
> >
> >    return [NSArray arrayWithObject:[selectedItem objectName]];
> > }
> >
> >
> > Even if this seems to be the only place where I can get the
> > destination URL,
> > it sounds so strange that I have to write the item-file within an API
> > returning namesOfPromisedFiles.... Or is it right?
> > Also, when I drag an item from the outlineView, if the destination is
> > the
> > outlineView itself, I don't have to create a file. I have just to move
> > the
> > item within the outline view. BUT, since I call
> > dragPromisedFilesOfTypes:
> > (see here above) to let the user drag the item to the Finder too, now
> > every
> > time I start a drag I see a white file icon and I cannot drag the item
> > within the outline view anymore. I can only drag it to the Finder.
> > Moreover, the API draggingSourceOperationMaskForLocal doesn't give me
> > any
> > info about the draggingPasteboard, so even if I override it, I cannot
> > change
> > the behaviour of the drag on the fly depending on the object is
> > overriding
> > the Finder or the object is overriding the outline view itself.
> > Amazing!
> >
> > I am sure I am missing something important. But what?
> > Why does this simple task is made so complicated?
> > Why there is not documentation nor sample code in the Developer/Example
> > folder?
> >
> >
> >
> > Best Regards
> > --
> > Lorenzo
> > email: <email_removed>
>
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list      (<email_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/karl.<email_removed>
>
> This email sent to karl.<email_removed>
>

Related mailsAuthorDate
mlDrag to Finder and create a file Lorenzo Apr 10, 20:46
mlRe: Drag to Finder and create a file Serge Meynard Apr 11, 00:49
mlRe: Drag to Finder and create a file The Karl Adam Apr 11, 03:59
mlRe: Drag to Finder and create a file Lorenzo Apr 11, 14:29
mlRe: Re: Drag to Finder and create a file Tim Hewett Apr 11, 17:24
mlRe: Drag to Finder and create a file Lorenzo Apr 11, 18:43
mlRe: Re: Drag to Finder and create a file The Karl Adam Apr 11, 19:24
mlRe: Drag to Finder and create a file Serge Meynard Apr 11, 19:27