Re: Why "self"? (Was: Newbie: Referencing Objects)

2008-10-28 Thread Siavash
Coming from a Flex/Flash background I will have to say that there is BIG differences between ActionScript 2.0 and 3.0. AS 3.0 is a powerful OOP language and AS 2.0 is not. That being said, the same object oriented principles do apply in ActionScript 3.0 the same as Obj-C and the Cocoa Frame

Re: Why "self"? (Was: Newbie: Referencing Objects)

2008-10-27 Thread john fogg
Hi Graham! On 10/28/08, Graham Cox <[EMAIL PROTECTED]> wrote: > FWIW, I tried to do some coding in Actionscript a few years ago after > being immersed in C++ for many years and then Objective-C/Cocoa for a > few years. To say that it was an exercise in utter frustration is an > understatement. [.

Re: Why "self"? (Was: Newbie: Referencing Objects)

2008-10-27 Thread Graham Cox
On 28 Oct 2008, at 2:30 pm, john fogg wrote: I come from coding in Actionscript (Flash) and there things are apparently quite different. FWIW, I tried to do some coding in Actionscript a few years ago after being immersed in C++ for many years and then Objective-C/Cocoa for a few years.

Re: Why "self"? (Was: Newbie: Referencing Objects)

2008-10-27 Thread john fogg
Hi Ken! Thank you for your long answer! It cleared up a lot of things for me. I come from coding in Actionscript (Flash) and there things are apparently quite different. Is it true that all instances I create live in memory on the same level? That they are all somehow equal? And that all relation

Re: Why "self"? (Was: Newbie: Referencing Objects)

2008-10-27 Thread john fogg
Ken Thomases wrote me off-list. I don't know if this was deliberate (I guess not) but I'd rather not quote his mail here without his consent. Anyways the problem is fixed and I understand it all a whole lot better now. Big thanks to everybody and esp. Ken. You all are very nice people!! __

Re: Why "self"? (Was: Newbie: Referencing Objects)

2008-10-27 Thread Ken Thomases
On Oct 27, 2008, at 9:35 PM, john fogg wrote: Here is the deal: I create a subobject called "mySubObject" inside my main object "myMainObject". Now I want to access "myMainObject" from within "mySubObject". Your terminology is a bit hard to follow. Part of the problem is that object's don't

Re: Why "self"? (Was: Newbie: Referencing Objects)

2008-10-27 Thread John Velman
I'm new to objective-C and cocoa also, I I don't know the answer to your specific question about "self". However, seems that one way to do it would be to have the init of mySubObject have an initializer with argument, and you would then create it something like this: SubObject * mySubObject = [[S

Re: Why "self"? (Was: Newbie: Referencing Objects)

2008-10-27 Thread Nick Zitzmann
On Oct 27, 2008, at 8:35 PM, john fogg wrote: Inside "mySubObject" I cannot access this by writing [pointerToMainObject doMethod]; but it works when I write [self.pointerToMainObject doMethod]; Why? What difference does "self" make here? Because the latter accesses the property of

Re: Why "self"? (Was: Newbie: Referencing Objects)

2008-10-27 Thread john fogg
Hi again! I'm still plucking along and any help is still greatly appreciated! Here is the deal: I create a subobject called "mySubObject" inside my main object "myMainObject". Now I want to access "myMainObject" from within "mySubObject". I'm still not sure what the ideal way to do this would be

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 NSApplicatio

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 "secondMainObjec

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 po

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 t

Re: Newbie: Referencing Objects

2008-10-26 Thread Graham Cox
On 27 Oct 2008, at 8:11 am, john fogg wrote: Does this apply even if I create my UI programatically? It applies as much as you want it to apply... by which I mean you are free to make a big ol' mess if you wish! But the MVC pattern keeps things sanely organised and should generally be fol

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 secondS

Re: Newbie: Referencing Objects

2008-10-26 Thread john fogg
Hi again! On Sun, Oct 26, 2008 at 10:02 PM, Ken Thomases <[EMAIL PROTECTED]> wrote: > [...] Does that help? Oh man, that helped a lot!! Thank you! Does this apply even if I create my UI programatically? I lay out all my interface elements with code and not in Interface Builder.

Re: Newbie: Referencing Objects

2008-10-26 Thread Ken Thomases
On Oct 26, 2008, at 3:21 PM, Nathan Kinsinger wrote: On Oct 26, 2008, at 2:05 PM, john fogg wrote: Hi again! Thank you everybody for your answers. On Sun, Oct 26, 2008 at 7:45 PM, Andy Lee <[EMAIL PROTECTED]> wrote: I don't know Actionscript but it looks like it has a global dictionary of

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

Re: Newbie: Referencing Objects

2008-10-26 Thread Nathan Kinsinger
On Oct 26, 2008, at 2:05 PM, john fogg wrote: Hi again! Thank you everybody for your answers. On Sun, Oct 26, 2008 at 7:45 PM, Andy Lee <[EMAIL PROTECTED]> wrote: I don't know Actionscript but it looks like it has a global dictionary of objects that you can reference by name. There is noth

Re: Newbie: Referencing Objects

2008-10-26 Thread john fogg
Hi again! Thank you everybody for your answers. On Sun, Oct 26, 2008 at 7:45 PM, Andy Lee <[EMAIL PROTECTED]> wrote: > I don't know Actionscript but it looks like it has a global dictionary of > objects that you can reference by name. There is nothing like "_root" in > Objective-C. I see, this

Re: Newbie: Referencing Objects

2008-10-26 Thread Andy Lee
On Oct 25, 2008, at 1:20 PM, john fogg wrote: If this helps: In Actionscript I'd write "_root.myObjectName.myFunctionName" and be set. Is there a way to access objects like this in Objective-C? I don't know Actionscript but it looks like it has a global dictionary of objects that you can refe

Re: Newbie: Referencing Objects

2008-10-26 Thread Nick Zitzmann
On Oct 25, 2008, at 11:20 AM, john fogg wrote: I create a Button and in the course of that I set a "target:" and an "action:". Unlike any and all of the examples I found on the web and on Apple's site I don't want the message sent to my current object, so I don't want "target:self" but another

Newbie: Referencing Objects

2008-10-26 Thread john fogg
Hi there! I'm stuck with Objective-C but then again I'm new to this. I searched the web for the last two days but maybe I'm looking in the wrong direction? I create a Button and in the course of that I set a "target:" and an "action:". Unlike any and all of the examples I found on the web and on