Re: Custom binding problem...can't figure out how to trigger a notification on set
Re: Custom binding problem...can't figure out how to trigger a notification on set
- Subject: Re: Custom binding problem...can't figure out how to trigger a notification on set
- From: Mike Abdullah <email@hidden>
- Date: Fri, 29 Sep 2006 17:36:57 +0100
Hi Eric, I can tell you exactly what your problem is :)
You have an NSObjectController to which you are binding your custom
view and the color well. That is fine and works as it should.
When you set the color using the well, this sets the color of the
NSObjectController and the view then picks up that this has happened.
However, when you set the color using one of the buttons, you are not
setting the color of the NSObjectController like you should. Instead
you are setting the color of the view directly. By doing this, the
color well never "sees" this change.
So, simply change your calls to something like:
[colorController setValue: [NSColor redColor] forKey:
@"backgroundColor"];
Mike.
On 29 Sep 2006, at 08:12, E. Wing wrote:
Hello, I have a simple bindings problem I'm hoping somebody can help
me with. I have condensed down my problem into a simple example
program which I have posted here:
http://www.geocities.com/ewing2121/NotificationProblem.tgz
Basically, I have a custom view object with a property I want to bind.
In this case, it is color. I wish to bind my color property to the
NSColorWell widget.
My problem is that the bindings seem to only work in one direction. I
can change the color wheel from the NSColorWell and my view object
changes appropriately. But if I set my view object's color directly,
the NSColorWell does not seem to get the notification that I changed
the view color so it does update itself.
I don't know what I'm supposed to do to 'trigger' this notification.
Can some body tell me where I'm going wrong?
The example program has a custom view that paints the entire view the
specified color. If you click on the NSColorWell, you should be able
to change the view colors. If you click on the buttons labeled with
different color names, they change the view color, but the NSColorWell
will not change to keep in sync.
Thanks,
Eric
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.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