• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: bindings only work one way?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >bindings only work one way? (From: Kenny Leung <email@hidden>)

  • Prev by Date: Re: Warning: "initialization from distinct Objective-C type". What does it mean?
  • Next by Date: Adding controls to an opengl fullscreen window
  • Previous by thread: bindings only work one way?
  • Next by thread: Adding controls to an opengl fullscreen window
  • Index(es):
    • Date
    • Thread