Re: AppleScipt & Cocoa, argh! I can't get it to work
Re: AppleScipt & Cocoa, argh! I can't get it to work
- Subject: Re: AppleScipt & Cocoa, argh! I can't get it to work
- From: Nat! <email@hidden>
- Date: Fri, 12 Apr 2002 22:25:50 +0200
Am Freitag den, 12. April 2002, um 01:53, schrieb Greg Titus:
On Thursday, April 11, 2002, at 02:50 PM, Nat! wrote:
Something can't be right. It looks like the object MUST be aware
of it's container to be able to produce the
NSScriptObjectSpecifier. The object must know the key it is
accessed with in the container class ? Ugh! This can't be true!
Sketch unfortunately just looks the same to me and doesn't help.
Yep. That's exactly right. To produce a specifier of where the
object is, the object has to know where it is. :-)
I think I'll put this into Radar. It seems that there should be
objectSpecifierForKey: method on the container, not a
objectSpecifier message on the contained.
As my next block in the road I found and stalled at
"toOneRelationships". I just created another class called
OtherStuff, just the same as Stuff. I put a "ToOneRelationship"
"otherstuff" on Application and tried:
tell application "AppleScriptTest"
set x to otherstuff
printa x
end tell
The Yield is this strange happening (Direct Parameter ???):
2002-04-11 23:37:35.194 AppleScriptTest[373] -> Execute Command:
XXX.Printa
Direct Parameter: 1867806054
Receivers: (null)
Arguments: {}
2002-04-11 23:37:35.194 AppleScriptTest[373] <- (null):(null)
Well, maybe this will lend insight:
1867806054 decimal is equal to 'oTuf', your code for the
otherstuff relationship.
Ah yes. I finally figured something out and that is that for
AppleScript-the-language there is no difference between a toOne and
a toMany relationship. So to access your toOne relationship
"foobar" (which are of class "Foo" (named "foo" in Applescript))
you say
tell application "MyApp"
set x to foobar 1
end tell
Counterintuitive but it works. On the bright side, I think you
don't need an objectSpecifier for that.
Generally, I don't see where a ToOneRelationship is beneficial
instead of making it an attribute - in scriptSuites that is.
It's probably a leftover from EOF <sniff>, where the distinction
between property and toOneRelationship makes more sense (inverse
relationships and such).
Cheers
Nat!
P.S. Of help was Create by Andrew Stone, that has one ToOne
relationship on "text area".
------------------------------------------------------
Some people drink deep from the fountains of life, and
some just gargle. -- DLR
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.