The reason I used only NSFilesPromisePboardType and not NSFilenamesPboardType is:My app data is stored as a package. Instead of extracting image from the package while I initiate dragging, I do it when the destination asks for the data that is promised to it. I personally feel NSFilesPromisePboardType will be better if we drag multiple files + need to convert files to different format that destination understands (In my case I create files with different flavors ex: PNG,JPEG etc in temp location and then move it to the destination.) Another advantage is, we can thread the creation of different flavors. Is there any way to transfer files to other apps using promised pasteboard?
Sample code:
- (NSArray *)namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination
{
Need to create Image in temp location and return the filename array.
}
-(void)mouseDragged:(NSEvent*)event
{
NSPasteboard *pBoard =[NSPasteboard pasteboardWithName: NSDragPboard]; [pBoard declareTypes:[NSArray arrayWithObject:NSFilesPromisePboardType] owner:inView]; [pBoard setPropertyList:[NSArray arrayWithObject:KAppFileFormat] forType:NSFilesPromisePboardType]; NSImage* imageToDrag= [[NSImage alloc]initWithContentsOfFile:filePath]; NSPoint cPoint = [inView convertPoint:[event locationInWindow] fromView:nil];

[inView dragImage:imageToDrag at:cPoint offset:NSMakeSize(0,0) event:event pasteboard:pBoard source:inView slideBack:YES];
  [imageToDrag release];                
}
Regards,
Dikshith
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to