On Sep 16, 2008, at 4:16 AM, Graham Cox wrote:

Well, the accessor method I had in mind, in its entirety, is:

- (id)          myOutlet
{
   return MyOutlet;
}

Thanks Graham,

Looks simple enough, however, I  can't seem to make it work.

I get a warning "warning: instance variable 'MyOutlet' accessed in a class method"


If I pause the execution in the implementation where MyOutlet is defined I see that it has valid pointers to memory:

        NSTextField *   MyOutlet        0x12c650
                Class           isa                     0xa027f1e0

In the other implementation that I am attempting to get the value of MyOutlet from, I am calling your suggested MyOutlet accessor method with:

        id MyOutletID = [MyContent MyOutlet];

MyOutletID has a pointer to memory, but the corresponding 'isa' class does not:

        id      MyOutlet        0xba4041
                Class           isa                     0x0

And when I step passed the line:

                float MyOutletFloat = [MyOutletID floatValue];

I get the message 'Program received signal: "EXC_BAD_ACCESS".'.

So far the only way I have been able to get the value of MyOutlet from a different class is by using a NSTimer function to set a global with the value of MyOutlet, then call a function to return the value of the global. This seems far from ideal, and while it is fine for testing purposes, I am curious on how to do it the "right" way.


note: by naming things as to their function you'd probably end up with a much more self-descriptive method.


Indeed, they are, just named them that for clarity here.


Cheers,

Jeshua Lacock
Founder/Programmer
3DTOPO Incorporated
<http://3DTOPO.com>
Phone: 877.240.1364

_______________________________________________

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]

Reply via email to