Re: NSFilePromisePboardType
Re: NSFilePromisePboardType
- Subject: Re: NSFilePromisePboardType
- From: The Karl Adam <email@hidden>
- Date: Fri, 17 Dec 2004 02:53:42 -0500
What event are you sending with that? Plus the docs read that it needs
to be invoked from the mouseDown: method since that has an event to
attach it to. Even if that wasn't the case, the entire point is that
you can't put extra data on the pboard with that method. with mine all
the data you want arrives intact then you attach the file promise
stuff. Though I don't use any extra types you can easily enough
change the code to support them.
Though do you have a code sampel with this working? Because when I
tried that method assumed that yes the mouse is down and being
dragged.
-Karl
On Fri, 17 Dec 2004 08:35:13 +0100, Peter Maurer <email@hidden> wrote:
> > ...
> > // FINALLY!!
> > // Okay HFS File promises work through a bit of black magic,
> > // I have h4x0red into it without revealing too much of it's workings
> > here
> > // I should edit this later to maintain whatever other info was on
> > the pboard
> > if ( [[pboard types] containsObject:NSFilesPromisePboardType] ) {
> > NSArray *promisedTypes = [[pboard
> > propertyListForType:NSFilesPromisePboardType] retain];;
> >
> > NSFilePromiseDragSource *aFSource = [[[NSFilePromiseDragSource
> > alloc] initWithSource:sourceObject] autorelease];
> > [pboard declareTypes:[NSArray
> > arrayWithObjects:NSFilesPromisePboardType, @"CorePasteboardFlavorType
> > 0x70686673", @"CorePasteboardFlavorType 0x66737350",
> > @"NSPromiseContentsPboardType", nil] owner:aFSource];
> >
> > // Construct the HFS Flavor for the Finder to use on Drop
> > PromiseHFSFlavor aFlavor;
> > memset( &aFlavor, 0, sizeof(aFlavor) );
> > if ( [promisedTypes containsObject:@"'fold'"] ) aFlavor.fileType =
> > 'fold';
> > aFlavor.fileCreator = '????';
> > aFlavor.promisedFlavor = 'fssP';
> > NSData *flavorData = [NSData dataWithBytes:&aFlavor length:14];
> > [pboard setPropertyList:promisedTypes
> > forType:NSFilesPromisePboardType];
> > [pboard setData:flavorData forType:@"CorePasteboardFlavorType
> > 0x70686673"];
> >
> > // Cleanup
> > [promisedTypes release];
> > }
>
> Why don't you simply use [NSOutlineView dragPromisedFilesOfTypes: ...]
> and override your outline view's
> -dragImage:at:offset:event:pasteboard:source:slideBack: method to add
> any additional pasteboard type you might want to use?
>
> <http://developer.apple.com/documentation/Cocoa/Conceptual/DragandDrop/
> Tasks/faq.html#//apple_ref/doc/uid/20002248/BBCFIJGF>
>
> Works fine for me, and it's a somewhat more "official" way of doing
> this ;-)
>
> Peter.
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden