• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSURLPboardType broken for dropping files in Panther...?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSURLPboardType broken for dropping files in Panther...?


  • Subject: Re: NSURLPboardType broken for dropping files in Panther...?
  • From: Kurt Marek <email@hidden>
  • Date: Mon, 3 Nov 2003 22:41:00 -0800

Well, my code is almost exactly that, but I still can't seem to switch rows in my table. My image shows up, but when I switch rows and then click back on the original row I get this output:


Cannot create URL from object NSImage 0x35b030 Size={576, 756} Reps=(
NSPDFImageRep 0x39f010 Size={576, 756} ColorSpace=NSCalibratedRGBColorSpace BPS=0 Pixels=0x0 Alpha=NO
) of class NSImage

Here's my dragging operation code:

- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{
NSPasteboard *pboard = [sender draggingPasteboard];

if ( [[pboard types] containsObject:NSFilenamesPboardType] ) {
NSURL *fileURL = [[NSURL alloc] initFileURLWithPath:[[pboard propertyListForType:NSFilenamesPboardType] objectAtIndex:0]];
[tableController setValue:fileURL forKeyPath:@"selection.URLToImageFile"];
[fileURL release];
return YES;
}
return NO;
}
@end


Strangely, if I use an openPanel to get the URL it works perfectly. Note that the method below is in the class that is controlled by the NSArrayController, tableController, referenced above, but the performDragOperation method is in the NSImageView subclass.

- (void)associateImageFile {

NSString *result;
NSOpenPanel *panel=[NSOpenPanel openPanel];
result = [panel runModalForDirectory:NSHomeDirectory()
file:nil types:[NSImage imageFileTypes]];

if (result !=NSCancelButton) {
[self setURLToImageFile:[[panel URLs] objectAtIndex:0]];
}
}


Kurt


On Nov 3, 2003, at 9:27 PM, mmalcolm crawford wrote:

On Nov 3, 2003, at 7:25 PM, Kurt Marek wrote:

Thanks for the app. It doesn't work on my system running 10.3. Dragging a file from the Finder to the imageView does nothing. Dragging a link from Safari works great. I think NSURLPoardType for files in the Finder is broken under Panther as was suggested by Rob.

Umm, so check for NSFilenamesPboardType (and if you get *one*, turn that into an URL)?
<http://homepage.mac.com/mmalc/CocoaExamples/ImageURLDragAndDrop.zip>
(updated).

mmalc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >NSURLPboardType broken for dropping files in Panther...? (From: Rob In der Maur <email@hidden>)
 >Re: NSURLPboardType broken for dropping files in Panther...? (From: Kurt Marek <email@hidden>)
 >Re: NSURLPboardType broken for dropping files in Panther...? (From: mmalcolm crawford <email@hidden>)
 >Re: NSURLPboardType broken for dropping files in Panther...? (From: Kurt Marek <email@hidden>)
 >Re: NSURLPboardType broken for dropping files in Panther...? (From: mmalcolm crawford <email@hidden>)

  • Prev by Date: Re: [OFF] Localisation (was Re: Security Framework: authorization rights.)
  • Next by Date: Re: [OFF] Localisation (was Re: Security Framework: authorization rights.)
  • Previous by thread: Re: NSURLPboardType broken for dropping files in Panther...?
  • Next by thread: Re: NSURLPboardType broken for dropping files in Panther...?
  • Index(es):
    • Date
    • Thread