some_id
some_id

Reputation: 29896

Detecting path of dragged item

How does one detect the path of a dragged item(File or Folder)?

Can this path be grabbed when it is dropped in an area?

Upvotes: 0

Views: 89

Answers (1)

Georg Fritzsche
Georg Fritzsche

Reputation: 98984

See Drag and Drop Programming Topics - Receiving Drag Operations for an introduction. When files are dropped, you receive an array of files from the pasteboard. An excerpt from the examples:

- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender {    
    NSPasteboard *pboard;    
    NSDragOperation sourceDragMask;

    sourceDragMask = [sender draggingSourceOperationMask];    
    pboard = [sender draggingPasteboard];

    if ( [[pboard types] containsObject:NSFilenamesPboardType] ) {
        NSArray *files = [pboard propertyListForType:NSFilenamesPboardType];
        // ...

Upvotes: 2

Related Questions