• 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
Pasteboard and property lists
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Pasteboard and property lists


  • Subject: Pasteboard and property lists
  • From: Thomas Lachand-Robert <email@hidden>
  • Date: Sat, 5 Jan 2002 16:26:29 +0100

It is possible to put an array in a Pasteboard using setPropertyList? The doc says so (even though it doesn't define "property list"), but it doesn'
t work for me. For instance, doing that:

- (IBAction) copy:(id)sender {
NSPasteboard* pboard = [NSPasteboard generalPasteboard];
NSArray* items = [self selectedObjectsByCopy:YES];
[pboard declareTypes:FileReferencePboardTypes owner:[FileReference class]];
/**/ [pboard setPropertyList:items forType:FileReferencePboardType];
/// [pboard setData:[items convertToData] forType:FileReferencePboardType]
;
}

- (IBAction) paste:(id)sender {
NSArray* items = nil;
NSPasteboard* pboard = [NSPasteboard generalPasteboard];
if (![pboard availableTypeFromArray:FileReferencePboardTypes]) return;
/**/ items = [pboard propertyListForType:FileReferencePboardType];
/// items = [NSArray arrayWithData:[pboard dataForType:FileReferencePboardType]];
.....
}

doesn't work for me: the returned "items" is an array with zero elements, whatever the number of elements it did contain in the copy method (no elements are released here). If I change the line starting with /**/ to the one commented with ///, it works. (Note that convertToData and arrayWithData are home-made extensions to NSArray.)

I have also tried to retain the array used in copy, with no result. How do you guys put arrays in the pasteboard?

Thomas Lachand-Robert
********************** email@hidden
<< Et le chemin est long du projet ` la chose. >> Molihre, Tartuffe.


  • Follow-Ups:
    • Re: Pasteboard and property lists
      • From: Chris Kane <email@hidden>
  • Prev by Date: Interactive UNIX command: a possible solution
  • Next by Date: Re: Running a regular expression on an NSString
  • Previous by thread: Interactive UNIX command: a possible solution
  • Next by thread: Re: Pasteboard and property lists
  • Index(es):
    • Date
    • Thread