cocoa scripting: selection
cocoa scripting: selection
- Subject: cocoa scripting: selection
- From: Ken Victor <email@hidden>
- Date: Thu, 22 Sep 2005 15:22:26 -0700
i'm attempting to support the current selection of a document in my
app. i've added a selection property to my document class as follows
(to my sdef):
<property name="selection" code="csel" type="specifier" list="yes"
access="r" description="The current selection.">
<cocoa key="selection"/>
</property>
and i've provided the selection instance method to my myDocument
class declared as follows:
- (id) selection;
i'm having several problems and would appreciate any help available.
1) if i return a "simple" object from selection, i get the following
message in the console log (in response to a "properties of document
1" script command):
...could not be converted to an Apple event descriptor of type
'document properties'. The 'selection' entry could not be converted
to an Apple event descriptor of type 'specifier'. This instance of
the class 'mySelectedObject' doesn't respond to
-scriptingSpecifierDescriptor messages.
i can't find any description of the -scriptingSpecifierDescriptor
messages. note that i have provided an objectSpecifier method for my
mySelectedObject class.
2) however, if instead of just returning the object as in 1, i return
[object objectSpecifier] it works fine. this is fine, except that i'm
rather confused. see more below.
3) however, if i return a NSArray from my selection method, i then
get the following:
...could not be converted to an Apple event descriptor of type
'document properties'. The 'selection' entry could not be converted
to an Apple event descriptor of type 'specifier'. This instance of
the class 'NSCFArray' doesn't respond to
-scriptingSpecifierDescriptor messages.
regardless of whether my array has 1 or more objects in it, and
regardless of whether the items in the array are "simple" objects or
object specifiers.
the reason for my confusion mentioned above is that elsewhere in my
sdef, i have specified a result of type specifier and list, and my
code simply returns an array of objects (not object specifiers).
so... what am i doing wrong? or more specifically, what should i be
returning from my selection method? of do i need to specify the
selection differently in my sdef file? and if so, how. somewhat
related, is it inappropriate for a class property to be a list? note
however, that removing the list declaration from the selection
property in my sdef did not get rid of any of the problems discussed
above.
(when searching the archives, all i could find was that selection is
not currently implemented in cocoa scripting. thats fine by me, i
don't mind providing my own implementation... that is, if i can get
it to work.)
thanx,
ken
_______________________________________________
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