Re: Newbie: Referencing Objects (second try)

2008-10-27 Thread Andreas Mayer


Am 27.10.2008 um 03:20 Uhr schrieb john fogg:


And how do I do this with my main application delegate? I want to call
it from wherever I am.



That one is already stored by your NSApplication object:

[NSApp delegate]

NSApp is a predeclared global variable that holds the current  
NSApplication instance.



Andreas
___

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 [EMAIL PROTECTED]


Re: Newbie: Referencing Objects (second try)

2008-10-26 Thread john fogg
Hi again!

I feel like I'm getting there. Though any help is still greatly appreciated!

On Mon, Oct 27, 2008 at 3:58 AM, john fogg <[EMAIL PROTECTED]> wrote:

> Or do I have to populate the variable once I created the object?

It does work! I create the "secondSubObject" inside my
"secondMainObject" and after that I set the property
"secondMainObject" in "secondSubObject" to secondMainObject's "self".

Only it is available after the object is initialized. I want to access
the property already during initialization.

Sorry for spamming the list. Please tell me if I should stop. :-)
___

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 [EMAIL PROTECTED]


Re: Newbie: Referencing Objects (second try)

2008-10-26 Thread john fogg
Hi again!

On Mon, Oct 27, 2008 at 3:20 AM, john fogg <[EMAIL PROTECTED]> wrote:

> OK I did that. But as far as I can tell I now have an empty variable
> named "secondMainObject" located in "secondSubObject". How do I store
> the reference to "secondMainObject" in the variable?

Or do I have to populate the variable once I created the object? I
created the accessor in "secondSubObject" as you said and tried (in
"secondMainObject")

secondSubObject.secondMainObject = self;

But it doesn't seem to work.

Hmpf!
___

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 [EMAIL PROTECTED]


Re: Newbie: Referencing Objects (second try)

2008-10-26 Thread john fogg
Hi again!

On Sun, Oct 26, 2008 at 10:40 PM, Nick Zitzmann <[EMAIL PROTECTED]> wrote:

> Use accessors. In secondSubObject, create an @property(assign)
> SecondMainObject *secondMainObject; so that you can call methods in
> secondMainObjct from secondSubObject.

OK I did that. But as far as I can tell I now have an empty variable
named "secondMainObject" located in "secondSubObject". How do I store
the reference to "secondMainObject" in the variable?

And how do I do this with my main application delegate? I want to call
it from wherever I am.

Thanks again for your help!! I can't stress this enough!
___

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 [EMAIL PROTECTED]


Re: Newbie: Referencing Objects (second try)

2008-10-26 Thread Nick Zitzmann


On Oct 26, 2008, at 2:59 PM, john fogg wrote:


When I'm inside "secondSubObject" how can I alter a variable in
"secondMainObject"?


Use accessors. In secondSubObject, create an @property(assign)  
SecondMainObject *secondMainObject; so that you can call methods in  
secondMainObjct from secondSubObject.


Note that it's important that you assign instead of retain in this  
instance, or else you'll create a retention loop memory leak unless  
you're using GC.



And how can I alter a variable in "firstMainObject"?



Again, use accessors so that objects can communicate with other objects.

Nick Zitzmann


___

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 [EMAIL PROTECTED]


Re: Newbie: Referencing Objects (second try)

2008-10-26 Thread john fogg
Hi again! And thank you for your kind help!!

Let me rephrase my question. I create two objects: "fistMainObject"
and "secondMainObject". Inside the second I create another object
called "secondSubObject".

When I'm inside "secondSubObject" how can I alter a variable in
"secondMainObject"?

And how can I alter a variable in "firstMainObject"?

Thanks again!
___

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 [EMAIL PROTECTED]