Re: drags from iTunes in an NSView just like iWeb [Solved]
Re: drags from iTunes in an NSView just like iWeb [Solved]
- Subject: Re: drags from iTunes in an NSView just like iWeb [Solved]
- From: "Nishant Yede" <email@hidden>
- Date: Tue, 03 Oct 2006 10:24:27 +0530
hi guys,
Finally i achive what i want and i thankfull to all of you who replied for my problem.
specially Fritz Anderson , David Dunham and Jim Puls.
Actually i missed some methods to overrides, but now i wrote that methods and reached to solution.
My final code snippest is as follows,
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
return NSDragOperationGeneric;
}
- (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender
{
return NSDragOperationGeneric;
}
- (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender
{
return YES;
}
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{
NSPasteboard *paste = [sender draggingPasteboard];
NSArray *types = [NSArray arrayWithObjects:NSFilenamesPboardType,nil];
NSString *desiredType = [paste availableTypeFromArray:types];
NSData *carriedData = [paste dataForType:desiredType];
NSArray *urlArray = [paste propertyListForType:NSFilenamesPboardType];
NSString *data = [[NSString alloc] initWithString:[urlArray objectAtIndex:0]];
NSLog([data description]);
if (nil == carriedData)
{
NSRunAlertPanel(@"Paste Error", @"Sorry, but the past operation failed", nil, nil, nil);
return NO;
}
else
{
if([musicFileType containsObject:[data pathExtension]])
{
[self createMusic:data];
}
else if([movieFileType containsObject:[data pathExtension]])
{
[self createMovie:data];
}
else if([imageFileType containsObject:[data pathExtension]])
{
[self createImage:data];
}
else if([docFileType containsObject:[data pathExtension]])
{
[self createDoc:data];
}
else
{
NSRunAlertPanel(@"UnSupported Files", @"Sorry, but the past operation failed due to unsupported files ", nil, nil, nil);
}
}
return YES;
}
There are again some methodes which can be use depends on indivisual requirement and these are,
- (void)draggingExited:(id <NSDraggingInfo>)sender
- (void)draggingEnded:(id <NSDraggingInfo>)sender
- (void)concludeDragOperation:(id <NSDraggingInfo>)sender
I again thanks to all of you.
--
______________________________________________
IndiaInfo Mail - the free e-mail service with a difference! www.indiainfo.com
Check out our value-added Premium features, such as an extra 20MB for mail storage, POP3, e-mail forwarding, and ads-free mailboxes!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden