On Friday, February 14, 2003, at 04:52 PM, Rich Morin wrote:
It must be a Cocoa object. Ordinarily, this would include Perl strings, as they're automatically "promoted" to NSString objects when passed to ObjC methods that expect that. But, there's a problem with the way the promotion is done, when NSOutlineView is used.is it necessary to use a Cocoa object as the "item" or can one use a Perl string?
The short explanation is, there is currently no way to create an NSString object that has been retained, but NSOutlineView requires the "item" objects you pass it to have been retained.
The longer explanation is, NSString objects returned to Perl are "demoted" to simple Perl scalars. So, you can't call their object methods - such as "retain" - as you can with other Cocoa objects. As I mentioned, when scalars are passed to an ObjC method that expects an NSString, they are "promoted" - new NSString objects are created. Unfortunately, NSString objects created this way are autoreleased, making them unsuitable for use as "items" in an NSOutlineView.
sherm--
If you listen to a UNIX shell, can you hear the C?