Re: Variables: Why one way and not another?
Re: Variables: Why one way and not another?
- Subject: Re: Variables: Why one way and not another?
- From: Robert Borsuk <email@hidden>
- Date: Sat, 1 Nov 2003 11:38:05 -0500
Woohoo. Okay, thanks Andreas, Alastair (and his project) and Uli. I
got it solved. Here's what I was doing wrong. When I made the nib I
instantiated the subclass in IB so I could connect my buttons actions
to it. Wrong. I should have just connected the button to the view.
This fixed the problems. It was weird because the action would be
called. Then it dawned on me with what Andreas said. I guess I was
actually creating two instances (one in the window and one I
instantiated. Life is good once again and my variables now work.
Thanks for everyones help.
Rob
Rob Borsuk
email: email@hidden
Colourfull Creations
Web:
http://www.colourfull.com
On Nov 1, 2003, at 11:07 AM, Andreas Mayer wrote:
Am 01.11.2003 um 16:34 schrieb Robert Borsuk:
In my program I route everything through the myview.m subclass. What
I mean by that is that I put a button on the window and join to an
action contained in the myview subclass.
You can't bind an action to a class. You bind actions to instances of
classes.
So which instance does your button send the myButtonPress: message to?
I suspect you created two different instances. The one which is drawn
and another one which is target of the button press message. Put some
NSLog calls in your methods to see what objects/instances are
involved:
- (void)drawRect:(NSRect)rect
{
NSLog(@"drawRect: %@", self)
...
}
-(IBAction)myButtonPress:(id)sender
{
NSLog(@"myButtonPress: %@", self)
...
}
bye. Andreas.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.