• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: getting dragged file's name
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >getting dragged file's name (From: Benjámin Salánki <email@hidden>)

  • Prev by Date: Re: IB Woes
  • Next by Date: Re: Random crash
  • Previous by thread: Re: getting dragged file's name
  • Next by thread: getting dragged file's name
  • Index(es):
    • Date
    • Thread