NSPasteBoard setPropertyList:forType
NSPasteBoard setPropertyList:forType
- Subject: NSPasteBoard setPropertyList:forType
- From: Stefan Heukamp <email@hidden>
- Date: Tue, 13 Dec 2005 22:06:25 +0100
Hi,
since I tried to store a pointer to an instance of one of my objects
in a NSPasteboard I'm quite confused about that concept.
For a Drag 'n Drop Operation within my Application I use the
NSPasteboard to store a path and a pointer to an object (which
represents the data in that path)
Here is an Extract from my source
- (BOOL) outlineView:(NSOutlineView *)outlineView writeItems:
(NSArray*)items toPasteboard:(NSPasteboard*)pboard {
[pboard declareTypes : [NSArray arrayWithObjects :
NSFilenamesPboardType, @"foo", nil] owner : self];
[pboard setPropertyList:[NSArray arrayWithObjects:[[items
objectAtIndex:0] getLocalPath], nil] forType:NSFilenamesPboardType];
BOOL res = [pboard setPropertyList:[NSArray arrayWithObjects:[items
objectAtIndex:0], nil] forType:@"foo"];
[pboard types];
NSArray* ar = [pboard propertyListForType:@"foo"];
int i = [ar count];
NSLog(@"result: %i, array: %@, count: %i", res, ar, i);
return YES;
}
The use of the NSFilenamesPboard ist without any problems. If I store
e.g. a NSString* in the fooBoard it is also no problem. But if I
store that pointer in the fooBoard as done above I get a result YES
but if I try reading it out the way I do it above I get a nil-Pointer
from NSArray* ar = [pboard propertyListForType:@"foo"];
What am I doning wrong? How do I get that pointer to my
outlineView:acceptDrop:item:childIndex function?
Thanks for any advice,
Stefan Heukamp
_______________________________________________
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