• 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: How to specify the file type to Audio file when dragging...?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to specify the file type to Audio file when dragging...?


  • Subject: Re: How to specify the file type to Audio file when dragging...?
  • From: Nick Zitzmann <email@hidden>
  • Date: Mon, 18 May 2009 22:45:23 -0600


On May 18, 2009, at 10:15 PM, Bright wrote:

Hi ,this is my code,but the code can not limit the file to Audio file :

- (NSDragOperation)tableView:(NSTableView*)tv validateDrop:(id <NSDraggingInfo>)info proposedRow:(int)row proposedDropOperation: (NSTableViewDropOperation)op

{

? ? [tv setDropRow:[tv numberOfRows] dropOperation:NSTableViewDropAbove];

? ? returnNSTableViewDropAbove;

}


That might be because you didn't actually do anything in this method. Here you need to check the dragging pasteboard via the NSDraggingInfo protocol object to see if it has a pasteboard you can read (which might be overly pedantic, but I'd do it anyway), and if it does, then you need to read it and check to see if the file path(s) in the pasteboard is/are valid, and if so, then you need to check the UTIs of each file to see if one identifies as an audio file as suggested earlier. If all of these are good, then you set the drop row to row (not -numberOfRows unless you really need it to go at the end), and return the appropriate NSDragOperation (not NSTableViewDropAbove, which is not an NSDragOperation). Otherwise, you return NSDragOperationNone.

That's what you need to do. Implementation is now an exercise for the reader. :)

Nick Zitzmann
<http://www.chronosnet.com/>



_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


References: 
 >Re: How to specify the file type to Audio file when dragging...? (From: Nick Zitzmann <email@hidden>)
 >Re: How to limit the file type when dragging? (From: "Sean McBride" <email@hidden>)
 >How to limit the file type when dragging? (From: Bright <email@hidden>)
 >Re: How to limit the file type when dragging? (From: Nick Zitzmann <email@hidden>)
 >Re: How to specify the file type to Audio file when dragging...? (From: Bright <email@hidden>)
 >Re:Re: How to specify the file type to Audio file when dragging...? (From: Bright <email@hidden>)

  • Prev by Date: Re: Databases on Cocoa (was Re: Invoice program made in Objective c/Cocoa)
  • Next by Date: Re: Databases on Cocoa (was Re: Invoice program made in Objective c/Cocoa)
  • Previous by thread: Re:Re: How to specify the file type to Audio file when dragging...?
  • Next by thread: Win->MacOS porting question.
  • Index(es):
    • Date
    • Thread