Multi-docs app structure

Hello!

I used Applescript “Studio” (in fact, XCode 3.2.5 with Applescript tab re-enabled) to create a multiple document application.

The problem is, instead of looking deep into the view hierarchy of IB, I tell my TextView to put itself into a property when awaking from nib.

Is the scope of this property application or document? It seems to be the application (but the property is in the document applescript). Shall I declare myTextView as a local variable?

Regards,
BF.

A property is scoped to the script object where it’s in.

Hello again, DJ!
And the script is the class, not the instances? Is it possible that all the instances share the SAME property? If I wrote in pascal

type CObject = object(TObject) (<-- CObject is the class)
var itsName: str255 (<-- itsName is a class variable)

firstObject = new(CObject);
firstObject.itsName:=‘First’

secondObject = new(CObject);
secondObject.itsName:=‘Second’ (<-- each instance has its OWN variable)

But in Applescript, my property seems to be SHARED between instances. If I click on a button of my second window (or my third), it’s always the textview of my FIRST window which is modified.

Or does the xib file return the same memory address? Strange, isn’t it?
Regards.

Don’t forget that studio is completely different from any kind of application. A studio application is an empty application where your script send and receive events from or to. For the end user it seems like an complete application but in fact it is an fully scriptable empty application that is managed from script(s), internally or externally.

Read this carefully and will fill out all your answers. It seems that you’re pointing to another script object and not creating an instance of the object…

propertyLabel
An identifier, unique within the script object, that specifies a characteristic of the object; equivalent to an INSTANCE VARIABLE.

So why my app always sent “update” to the same text view, even if a NEW document is open with its own text view instance?

Shoud I refer explicitely, like “my myTextView” or “myTextView of me” (equivalent to the SELF keyword?)

Exactly, you defined the instance variable in the class and not at runtime (constructor) so every instance of that class will have the same property value. It has nothing to do with sharing it’s just giving ever instance variable the same value.