Re: getting dragged file's name
Re: getting dragged file's name
- Subject: Re: getting dragged file's name
- From: John Pattenden <email@hidden>
- Date: Thu, 7 Aug 2003 21:14:29 -0400
I use this code - should get you 95% of the way there..
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
NSPasteboard *pb = [sender draggingPasteboard];
NSString *type = [pb availableTypeFromArray:[NSArray
arrayWithObject: NSFilenamesPboardType]];
if (type != nil){
NSArray *files = [pb propertyListForType:NSFilenamesPboardType];
if ( [files count] == 1 ) {
if ([[[files objectAtIndex:0] pathExtension]
isEqualToString:@"jpg"])
return NSDragOperationCopy; //accept data as a copy
operation
}
}
return NSDragOperationNone;
}
On Wednesday, August 6, 2003, at 03:34 AM, Benjamin Salanki wrote:
>
Hi,
>
>
I have an NSImageView which accepts dragged files. I can't find a way
>
to get the path of the file dragged onto it. Can anybody please point
>
me into the right direction?
>
>
thx.
>
>
ben
>
>
stupidFish23
>
http://www.stupidfish23.com
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.