Re: Bidirectional, Manual Binding in custom control

2012-06-28 Thread Jerry Krinock
On 2012 Jun 28, at 11:04, Quincey Morris wrote: > I'm not sure now why your control needs a 'rating' ivar. Doesn't this just > duplicate the value of the control's objectValue, and create extra > housekeeping? In this situation, probably yes, but it is quite normal for Cocoa controls to have

Re: Bidirectional, Manual Binding in custom control

2012-06-28 Thread Quincey Morris
On Jun 28, 2012, at 10:49 , Jerry Krinock wrote: > OK, but effectively this means that I simply factor this -changeRating: > action method out of my -mouseDown: method. Only -mouseDown: will invoke > -changeRating: at this time. > > I don't think I've ever seen a control class implementing an

Re: Bidirectional, Manual Binding in custom control

2012-06-28 Thread Jerry Krinock
On 2012 Jun 27, at 22:42, Quincey Morris wrote: > the setter should only contain the second part ("Set ivar, needsDisplay"). > > It seems to me this should prevent selection changes from rebounding onto the > data model. Yes. > Using mouseDown kinda feels wrong to me. Wouldn't it make more se

Re: Bidirectional, Manual Binding in custom control

2012-06-27 Thread Quincey Morris
On Jun 27, 2012, at 22:12 , Jerry Krinock wrote: >> On May 21, 2012, at 20:44 , Jerry Krinock wrote: > >>> -(void)setRating:(float)rating >>> { >>> // Stuff to make reverse binding work… >>> NSDictionary* bindingsInfo = [self infoForBinding:@"rating"] ; >>> id object = [bindingsInfo objectF

Re: Bidirectional, Manual Binding in custom control

2012-06-27 Thread Jerry Krinock
On 2012 May 21, at 21:52, Quincey Morris wrote: > On May 21, 2012, at 20:44 , Jerry Krinock wrote: >> -(void)setRating:(float)rating >> { >>// Stuff to make reverse binding work… >>NSDictionary* bindingsInfo = [self infoForBinding:@"rating"] ; >>id object = [bindingsInfo objectForKey

Re: Bidirectional, Manual Binding in custom control

2012-05-22 Thread Jerry Krinock
On 2012 May 21, at 21:52, Quincey Morris wrote: > This seems more or less the correct approach to defining a custom binding. > "More or less" because you may have committed some minor technical violation > of custom binding implementations, described unintelligibly in this document: > >

Re: Bidirectional, Manual Binding in custom control

2012-05-21 Thread Quincey Morris
On May 21, 2012, at 20:44 , Jerry Krinock wrote: > and then binding to it in the window controller's -awakeFromNib like this… > [starRatingView bind:@"rating" >toObject:fooController > withKeyPath:@"selection.rating" > options:beForgiving] ; > -(void)setRating:(fl

Bidirectional, Manual Binding in custom control

2012-05-21 Thread Jerry Krinock
I modified a "Star Rating" control to be bindings compatible by adding this… + (void)initialize { [self exposeBinding:@"rating"] ; } and then binding to it in the window controller's -awakeFromNib like this… // beForgiving is to handle NSNoSelectionMarker & friends… NSDictionary* beForgiving