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 (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