I am trying to limit files with certain UTI's from dropping into a table view. Here's my code so far:
// in the init method I set the registerForDraggedTypes with NSURLPboardType -(NSDragOperation) tableView: (NSTableView*)tv validateDrop: (id <NSDraggingInfo>)info proposedRow: (int)row proposedDropOperation: (NSTableViewDropOperation)op { NSDragOperationdragOp = NSDragOperationCopy; // if drag source is self its a move unless the option key is pressed if ([info draggingSource] == playlistView) { NSEvent *currentEvent = [NSApp currentEvent]; int optionKey = [currentEvent modifierFlags] & NSAlternateKeyMask; if (optionKey == 0) dragOp = NSDragOperationMove; // option not pressed return dragOp; } // if drag source is not self then... OUTSIDE FILE BEING DRAGGED IN NSArray*firstType = [NSArrayarrayWithObjects:NSURLPboardType, nil]; if([[[info draggingPasteboard] types] containsObject:NSURLPboardType] ) { NSString *availableType = [[info draggingPasteboard] availableTypeFromArray:firstType]; NSString *fileType; NSURL *url; NSArray *filesList = [[info draggingPasteboard] propertyListForType:availableType]; for (int i=0; i<[filesList count]; ++i) { url = [filesList objectAtIndex:i]; if ([url getResourceValue:&fileType forKey:NSURLTypeIdentifierKey error:NULL]) { NSLog(@"%@", fileType); // just print the type for now } } } [tv setDropRow:row dropOperation:NSTableViewDropAbove]; return dragOp; } So as I'm sure you've noticed, I'm not changing the dragOp for an outside file being dragged in. For some reason I keep getting an unrecognized selector error with the getResourceValue:forKey:error: method. I'm completely stumped, any help would be greatly appreciated. GW _______________________________________________ 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