Re: bindings only work one way?
Re: bindings only work one way?
- Subject: Re: bindings only work one way?
- From: Kenny Leung <email@hidden>
- Date: Sat, 15 Oct 2005 17:44:45 -0700
Hi All.
It seems I can make it work by modifying TransparencyControl's
setAlpha method to look like this:
- (void)setAlpha:(float)value
{
NSDictionary *dict;
if ( value != _alpha ) {
_alpha = value;
dict = [self infoForBinding:@"alpha"];
[[dict objectForKey:NSObservedObjectKey] takeValue:[NSNumber
numberWithFloat:_alpha] forKeyPath:[dict
objectForKey:NSObservedKeyPathKey]];
[self setNeedsDisplay:YES];
}
}
While this works, it doesn't seem like I should have to do this.
Since the bindings system knows that "alpha" is bound, shouldn't it
propagate the value for me automatically?
Thanks for any insight.
-Kenny
On Oct 15, 2005, at 5:23 PM, Kenny Leung wrote:
Hi All.
I think I'm doing everything right with bindings, but perhaps I'm
misunderstanding something. I have a custom control which controls
transparency. Since this is a custom control, I'm hooking up the
binding programmatically. I hook the control up to my
WindowController using:
[transparencyControl bind:@"alpha" toObject:self
withKeyPath:@"superimpositionView.alpha" options:nil];
It all works perfectly - almost. The binding appears to be read-
only - that is, when I change the alpha value in
superimpositionView, it changes the value on the control, but when
I manipulate the control, it will not change the value in
superimpositionView. Am I missing something basic about bindings?
Any help is much appreciated.
Thanks!
-Kenny
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40pobox.com
This email sent to email@hidden
_______________________________________________
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