0
votes

I have an NSImageView with drag and drop connected as follows:

-(NSDragOperation)draggingEntered:(id<NSDraggingInfo>)sender{

    if ((NSDragOperationGeneric & [sender draggingSourceOperationMask])
        == NSDragOperationGeneric) {

        return NSDragOperationGeneric;

    } // end if

    // not a drag we can use
    return NSDragOperationNone;
}


-(NSDragOperation) draggingUpdated:(id<NSDraggingInfo>)sender{

    return NSDragOperationCopy;
}

-(void) draggingEnded:(id<NSDraggingInfo>)sender{

    NSPasteboard *pboard = [sender draggingPasteboard];

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

        // Loop through all the files and process them.
        for( int i = 0; i < [files count]; i++ )
        {
             ....
        }
}

This all works great. When dragging fils from Finder it indicates the plus if inside the view and remove the plus when outside. It also indicates how many files to copy in a little bubble. All that works great. However, if I drag over the view and outside the application the plus goes away but on release it still drops the files into the view. How can I stop that behavior ?

Thanks very much for any ideas.

1

1 Answers

0
votes

I think I have found the solution.

Instead of using draggingEnded I use performDragOperation and all works.