Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Cocoa Scripting: property with multiple types
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa Scripting: property with multiple types



On 22 Aug 2005, at 9:02 AM, Mark Alldritt wrote:

Hi,


On a related note, if I want to return missing value for a property
that
normally returns an integer, boolean or string, how do I do this?


I still haven't heard whether this actually works, and I haven't touched my own code in a long time, but maybe you can declare

    <value-type name="missing value" code="msng">
        <cocoa class="NSNull"/>
    </value-type>

in your sdef file and return [NSNull null] from the accessors.


Will this work with accessors that return scalar value (int, BOOL)? Surely,
returning [NSNull null] will be interpreted as TRUE for a BOOL accessor and
as an arbitrary integer for int accessors.

Well, if you are dealing with BOOLs, sentinel values (special values like -1 or 0 signifying missing value) aren't an option.


So, you have to have the accessor return an NSNumber or NSNull (i.e., an id).
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-implementors mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
References: 
 >Re: Cocoa Scripting: property with multiple types (From: Mark Alldritt <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.