On Aug 30, 2011, at 9:49 PM, Julie Porter wrote:

> What I do not get, is why an accessor such as an abstract getObject can not 
> get the Object from the open and instantiated MyDocument class. 

I think maybe you’re not thinking the right way about “instantiated” (and 
“open” really doesn’t mean anything here.) “Instantiating” means “creating an 
instance”, i.e. creating an object that belongs to that class. It’s comparable 
to malloc. Saying “MyDocument is instantiated” just means that, somewhere in 
memory, there is an object whose class is MyDocument. It does not imply that 
there is any way to find that object given only knowledge of the class. There 
could be millions of MyDocument objects at any moment

The getObject accessor is a method of MyDocument, but methods have to be called 
on objects. Otherwise it’s like calling Carbon’s GetWindowTitle without giving 
it a WindowPtr. The state that you want to access belongs to an individual 
MyDocument object, so there is no way to get it without having a reference to 
that object.

> What does IB have to do with my database and communication between functions? 
>  I thought this was for things like buttons and cells so that when one 
> presses a button the value in a cell is passed to the function.

Wiring in IB defines connections between arbitrary objects. It just happens 
that most of the objects you wire up are views. When you define a connection in 
a nib, then when the objects are loaded into memory they will be set up to 
point to each other.

> I think cocoa is the other way around,  Where the document which has the 
> array of dictionaries I want is not visible to the View because the view is 
> not open to the document.

Honestly, the metaphor doesn’t apply at all. There is no such thing as “open” 
or “visible”. There is no state involved. Trying to make analogies to 
PostScript is just going to confuse you even more. The document and view are 
fancy structs in memory, and for one to be able to access the contents of 
another, it has to have a pointer to it as one of its members. Does that make 
more sense?

—Jens_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to