Re: When are bound variables initialized?
Re: When are bound variables initialized?
- Subject: Re: When are bound variables initialized?
- From: Michael Lutz <email@hidden>
- Date: Tue, 12 Apr 2005 22:05:57 +0200
Well, I try to initialize it in awakeFromNib: [selectedXAxisValue
setString:@"Distance"];
But at that point of time the Chart window was not displayed the first
time. And so selectedXAxisValue is nil and the setString message has no
effect.
So my question is: When changes the selectedXAxisValue from nil to a
real object? Or do i have to alloc] init] it? I tried it once but I
remember I got some signal error when I released it in AppController's
dealloc method.
Many thanks,
Michael
On Apr 12, 2005, at 21:34, Kevin Ballard wrote:
I assume you're setting a value for selectedXAxisValue yourself, yes?
There are two potential solutions:
1) Instead of setting it directly, use your setter method. This will
notify the bound object to update itself
2) Use [self willChangeValueForKey:@"selectedXAxisValue"] right before
setting it manually and [self
didChangeValueForKey:@"selectedXAxisValue"] right after setting it.
This has the same effect as solution #1.
On Apr 12, 2005, at 2:34 PM, Michael Lutz wrote:
in one NIB I have two windows: One main and one Chart window. Those
two windows are controlled by one 'AppController' class. The Chart
window has two radio buttons on it, where the selectedValue is bound
to NSMutableString *selectedXAxisValue. When I show the Chart
window the first time selectedValue is nil and none of the buttons is
selected.
So my question is: When is selectedValue initialized the first time
and how can I initialize it up-front (so one button is selected)?
--
Kevin Ballard
email@hidden
http://www.tildesoft.com
http://kevin.sb.org
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden