While performing a drag and drop in NSOutlineView at the point where I accept 
the drop I
want to throw up an NSPopover at the drop point with some options and an accept 
or decline button to ultimately 
accept or refuse the drop. The popover needs to run modal so as to block on the 
return to accept. So this in short 
is what I'm doing:

- (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id 
<NSDraggingInfo>)info item:(id)item childIndex:(NSInteger)index
{
        [popover showRelativeToRect:rect ofView:outlineView 
preferredEdge:preferredEdge];

        NSWindow *window = popover.contentViewController.view.window;
        
        NSInteger ret = [NSApp runModalForWindow:window];
        
        return (ret == 1);
}

This works but the problem is the drag image ends up on top of the popover 
obscuring some 
of the controls. I have tried to remove the drag image by running

        [info enumerateDraggingItemsWithOptions:0
                forView:outlineView
                classes:[NSArray arrayWithObject:[NSURL class]]
                searchOptions:nil
                usingBlock:^(NSDraggingItem *draggingItem, NSInteger idx, BOOL 
*stop) {
                        // tried this
                        [draggingItem setDraggingFrame:NSZeroRect contents:nil];
                        // and this
                        draggingItem.imageComponentsProvider = nil;
                        // but neither work
                }];

just before showing the popover but this has no effect.

I also tried subclassing NSOutlineView and doing

- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{       
        [sender enumerateDraggingItemsWithOptions:0
                forView:self
                classes:[NSArray arrayWithObject:[NSURL class]]
                searchOptions:nil
                usingBlock:^(NSDraggingItem *draggingItem, NSInteger idx, BOOL 
*stop) {
                        draggingItem.imageComponentsProvider = nil;
                }];
        
        return [super performDragOperation:sender];;
}

but no joy here either.

Any help on doing this would be greatly appreciated
I'm using the newer multi pasteboard item api

- (id <NSPasteboardWriting>)outlineView:(NSOutlineView *)outlineView 
pasteboardWriterForItem:(id)item

Thanks
Jonathan
_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to