Re: Was: Re: NSStepper - useless?
Re: Was: Re: NSStepper - useless?
- Subject: Re: Was: Re: NSStepper - useless?
- From: Graham Cox <email@hidden>
- Date: Mon, 27 Feb 2012 11:58:58 +1100
On 27/02/2012, at 11:44 AM, William Squires wrote:
> I'm just saying the stepper itself should not have a value, it should send actions to a controller so it can manipulate a numeric value in a model object, or it should be able (using bindings) to increment/decrement a model's value. Using the UI as a model isn't what MVC is all about.
OK, so by that argument, no controls should have a value. Sliders should not have a value. How then is that control going to draw itself? The position of the slider is determined by its value relative to its min and max. If that value can't be determined then the control will appear incorrectly, and controls have no way to "ask" the data model for a value - it's up to the relevant controller to push the value to the control.
Since all controls work that way, why should NSStepper be an exception?
In general I would agree that caching a value in more than one place is not usually a good idea because of all the synchronisation issues that implies, but for controls it's justified. In any case, correct use of controls, whether through target/action or through bindings, takes care of the synch. issue. If you are having trouble with that, you probably haven't got it set up correctly. I use text field/stepper/slider combinations all over the place and have never had to concern myself with synch. issues, even though all three in a triple store the same value - get it right and really, it Just Works.
You might as well get used to it, that's how it is.
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden