• 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
Re: Getting objectSpecifier right...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting objectSpecifier right...


  • Subject: Re: Getting objectSpecifier right...
  • From: Dustin Voss <email@hidden>
  • Date: Sun, 10 Oct 2004 22:28:06 -0700

On 10 Oct, 2004, at 5:21 PM, Doug Knowles wrote:

Dustin Voss wrote:

<x-tad-bigger>Actually, no. It should be the class description for the container. The
easiest way to get this is to call (NSScriptClassDescription *) [[self
repository] classDescription], assuming I read your code right. There
is no need to check with the suite registry.
</x-tad-bigger>

I have changed this per your advice, with no change to the results.

Here's more observations:

- The class I'm having trouble with is the target of several "to-many" relationships; i.e., network of "category" classes that refer to each other through various to-many relationships. As a consequence, my "element" descriptions need to refer to the relationship by names other than the type of the class, such as "children", "parents", etc. So I describe the relationship as:

<element type="child" access="r" description="Child(ren) in category hierarchy" >
<cocoa method="childCategories"/>
</element>

...which forces me to create a type for the reference:

<class name="child" plural="children" code="chld" description="Child(ren) of a category" inherits="category">
<cocoa class="Category"/>
</class>

I think this is a limitation of sdef files. In truth, the element name ought to be "children", but the class should be "category". You can manually adjust the .scriptSuite or .scriptTerminology files, but I think there is a better work-around.

There is no rule in AppleScript that says that elements have to be a particular class. In fact, if you look at TN 2016 (at http://developer.apple.com/technotes/tn2002/tn2106.html) there is an example of how a "duck" element can return "mallard", etc.

You should be able to use this to your advantage. Just create empty <class> declarations for "child", "parent", etc., with no inheritance information. These will be placeholders, with no Cocoa equivalent. In the appropriate Cocoa accessor methods, return a "category" object instead of "child" or "parent" or whatever.

Of course, one thing you have to look out for is the object specifier. The "category" objects can't return themselves as "child x of whatever" or "parent y of whatever"; you'd have to return them as "category z of categories" or something. I think you've done this already.

<x-tad-bigger>I wrote a guide for supporting AppleScript with Cocoa - the most complete
I've seen - at <</x-tad-bigger><x-tad-bigger>http://cocoadev.com/?HowToSupportAppleScript</x-tad-bigger><x-tad-bigger>>. If you
haven't checked it out already, you should.
</x-tad-bigger>

I have had that page open on my desktop for days now; it has been very helpful to get me this far. Thanks!

I'm glad it's helped, and you're welcome.
_______________________________________________
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
References: 
 >Getting objectSpecifier right... (From: Doug Knowles <email@hidden>)
 >Re: Getting objectSpecifier right... (From: Doug Knowles <email@hidden>)

  • Prev by Date: Re: Calling a method based on a string
  • Next by Date: Re: Emailing RTF
  • Previous by thread: Re: Getting objectSpecifier right...
  • Next by thread: Can I reset NSEvent's clickCount threshold?
  • Index(es):
    • Date
    • Thread