Re: Path of imagefile that was dragged to NSImageView
Re: Path of imagefile that was dragged to NSImageView
- Subject: Re: Path of imagefile that was dragged to NSImageView
- From: Henry McGilton <email@hidden>
- Date: Tue, 23 Dec 2003 13:03:42 -0800
On Tuesday, December 23, 2003, at 11:58 AM, Sven Hoffmann wrote:
Hello again!
How do i determine the filepath of a image that was dragged to an
NSimageView?
i read the drag and drop section of the cocoa documentation several
times...
i just dont get it.
Something like this (you *have* sub-classed NSimageView, haven't you?):
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{
NSPasteboard *pasteboard = [sender draggingPasteboard];
BOOL result = NO;
if ([[pasteboard types] containsObject: NSFilenamesPboardType]) {
NSArray *files = [pasteboard propertyListForType:
NSFilenamesPboardType];
filepath = (NSString *)[files objectAtIndex: 0];
currentimage = [[NSImage alloc] initWithContentsOfFile:
(NSString *)filepath];
[self display];
result = YES;
}
return result;
}
Cheers,
........ Henry
===============================+============================
Henry McGilton, Boulevardier | Trilithon Software
Objective-C/Java Composer | Seroia Research
-------------------------------+----------------------------
mailto:email@hidden |
http://www.trilithon.com
|
===============================+============================
_______________________________________________
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.