I want to us e the whole window of my application as the drop target for files dragged onto it from the Finder but there are a couple of things I can't seem to figure out:

I would like to show some sort of visual feedback. I tried subclassing the content view of the window thinking it would automatically hilite, but I can't get it to. Note I set focus ring to default in IB for this. Also the drag icon doesn't update to show a '+' symbol.

After I get the file what should I do to make sure the document is still set up correctly. I currently call my documents readFromURL: ofType: error: method to load the file but I am not sure if that is correct as calling synchronizeWindowTitleWithDocumentName afterwards doesn't change the title of the window to the new file name.

Note that I would like to reuse the document and window, not create a new one. This is what I am currently doing inside my NSWindowController subclass:

- (void)awakeFromNib{
        
[[self window] registerForDraggedTypes:[NSArray arrayWithObjects:NSURLPboardType, nil]];
}



- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender {
        
        return NSDragOperationGeneric;
}


- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender{
         NSPasteboard *pboard = [sender draggingPasteboard];
        
        
        if ( not [[pboard types] containsObject:NSURLPboardType] )
                return NO;
        
if( not [[self document] readFromURL:[NSURL URLFromPasteboard:pboard] ofType:@"AVR Hex File" error:nil])
                return NO;
                
        [self synchronizeWindowTitleWithDocumentName];
        
        return YES;
}


thanks for any help!

Peter
_______________________________________________

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