Hi all
   
     Now, I want to drag and drop sound files(such as mp3) into a tableview to 
implement the sound-files' playing.
But  how limit the file type to sound file only available when drag and drop 
files into tableview?
my code is :

- (BOOL)tableView:(NSTableView*)tv acceptDrop:(id <NSDraggingInfo>)info 
row:(int)row dropOperation:(NSTableViewDropOperation)op

{

    NSPasteboard *myPasteboard=[info draggingPasteboard];

    NSArray *typeArray=[NSArray arrayWithObjects:NSFilenamesPboardType,nil];

    NSString *filePath,*availableType;

    NSArray *filesList;

    int i;

    availableType=[myPasteboard availableTypeFromArray:typeArray];

    filesList=[myPasteboard propertyListForType:availableType];




    for (i=0;i<[filesList count];i++)

    {

        filePath=[filesList objectAtIndex:i];

        [songs insertObject:filePath atIndex:row+i];

    }

    [songTable reloadData];

    [songTable selectRow:row+i-1 byExtendingSelection:NO];

    return YES;

}



Thank you 
Bright

_______________________________________________

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