Re: Was: Re: NSStepper - useless?

2012-02-26 Thread William Squires

On Feb 23, 2012, at 2:13 PM, Seth Willits wrote:

 On Feb 23, 2012, at 6:16 AM, William Squires wrote:
 
 From what I've read, the NSStepper has a bug (though practically, you'll 
 never see it); if one were to click the up or down arrow on the control 2^32 
 times (assuming it's value is a 4-byte signed int,and is initialized to 0), 
 it would wrap around (or raise an exception for integer overflow). Probably 
 not what the user had in mind!
 
 It's pretty irrelevant, because you wouldn't be using a stepper control for 
 values in the billions. That'd be a poor UI. Just like if a table view had a 
 couple billion rows in it in (in 32-bit) it would have broken as well. But 
 it's a terrible thing to do in the first place. ;)
 
 
 Why didn't they just make the NSStepper a custom view that draws two arrows, 
 and has two sent actions that you can connect? Or even a variation of 
 NSMatrix with two button cells that look like arrows. That would avoid the 
 problem entirely, and be more intuitive to use.
 
 Not really. The control's intended use is to increment and decrement a value. 
 That's what it does. If you're not using the stepper for manipulating a 
 numeric value, you should probably be using a different control.
 
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.

 
 --
 Seth Willits
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 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:
 https://lists.apple.com/mailman/options/cocoa-dev/wsquires%40satx.rr.com
 
 This email sent to wsqui...@satx.rr.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Was: Re: NSStepper - useless?

2012-02-26 Thread Graham Cox

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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Was: Re: NSStepper - useless?

2012-02-26 Thread Seth Willits
On Feb 26, 2012, at 4:44 PM, William Squires wrote:

 Why didn't they just make the NSStepper a custom view that draws two 
 arrows, and has two sent actions that you can connect? Or even a variation 
 of NSMatrix with two button cells that look like arrows. That would avoid 
 the problem entirely, and be more intuitive to use.
 
 Not really. The control's intended use is to increment and decrement a 
 value. That's what it does. If you're not using the stepper for manipulating 
 a numeric value, you should probably be using a different control.
 
 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.


The stepper having a value doesn't break MVC any more than a text field having 
a string value, or a slider having a numeric value, does. And bindings require 
that the stepper have a value to begin with. 

All basic controls are architected the same way — they all maintain a value 
which they display and manipulate. When that value changes, they send an 
action. A stepper doesn't display it's value, but there's little or no benefit 
to architecting it totally differently. That would just be pushing more 
responsibility onto the controller which isn't necessary when the stepper can 
do it correctly for everyone to begin with. 

Whatever scenario you've cooked up where you need to know whether the value is 
being incremented or decremented (which you can still easily do) is not the 
norm.


--
Seth Willits


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Was: Re: NSStepper - useless?

2012-02-26 Thread John Joyce

 
 
 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
 
I would simply say that NSStepper only knows about its own state. It is quite 
inline with MVC.
What the op is asking for is a more generic vertically oriented segmented 
button or a pair of NSButtons. That is super easy to implement. 
NSStepper is a precise type of form control for incrementing/decrementing a 
value. The value can be mapped to any sequential data. Dates and times are 
quite suited to it. Really anything that might have a reasonably narrow, 
precise granular increment. 
The only real question I see is whether the data incremented might also need a 
large scale ability to increment like a slider or nob or a combo box. 
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Was: Re: NSStepper - useless?

2012-02-24 Thread Gregory Weston
William Squires wrote:

 Why didn't they just make the NSStepper a custom view that draws two arrows, 
 and has two sent actions that you can connect? Or even a variation of 
 NSMatrix with two button cells that look like arrows. That would avoid the 
 problem entirely, and be more intuitive to use.

Um. Because that's not what the control *is*. An NSStepper is a numeric input, 
for which the interface happens to be a pair of arrows. It's not just a pair of 
arrows that do whatever you want in response to pressing on each of them. Think 
of stepper in the context of motor. If it was just two arrows with 
connectable actions it would be less intuitive and more difficult to use for 
what it was designed to do. If you want to augment the intended behavior, KVO 
is probably the way to go. If you want to do something completely different, 
your should have your own control and it shouldn't look especially like a 
stepper.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Was: Re: NSStepper - useless?

2012-02-23 Thread William Squires
From what I've read, the NSStepper has a bug (though practically, you'll never 
see it); if one were to click the up or down arrow on the control 2^32 times 
(assuming it's value is a 4-byte signed int,and is initialized to 0), it would 
wrap around (or raise an exception for integer overflow). Probably not what 
the user had in mind! Why didn't they just make the NSStepper a custom view 
that draws two arrows, and has two sent actions that you can connect? Or even 
a variation of NSMatrix with two button cells that look like arrows. That 
would avoid the problem entirely, and be more intuitive to use.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Was: Re: NSStepper - useless?

2012-02-23 Thread Kyle Sluder
On Thu, Feb 23, 2012 at 6:16 AM, William Squires wsqui...@satx.rr.com wrote:
 From what I've read, the NSStepper has a bug (though practically, you'll 
 never see it); if one were to click the up or down arrow on the control 2^32 
 times (assuming it's value is a 4-byte signed int,and is initialized to 0), 
 it would wrap around (or raise an exception for integer overflow). Probably 
 not what the user had in mind! Why didn't they just make the NSStepper a 
 custom view that draws two arrows, and has two sent actions that you can 
 connect? Or even a variation of NSMatrix with two button cells that look like 
 arrows. That would avoid the problem entirely, and be more intuitive to use.

Because NSStepper is over 20 years old, dating back to when the way to
push values around was to wire up a control's action to another
control's -takeValueFrom: method. Besides, all sorts of crazy things
tend to happen anyway when you try to use UINT_MAX for anything
useful.

--Kyle Sluder

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Was: Re: NSStepper - useless?

2012-02-23 Thread Seth Willits
On Feb 23, 2012, at 6:16 AM, William Squires wrote:

 From what I've read, the NSStepper has a bug (though practically, you'll 
 never see it); if one were to click the up or down arrow on the control 2^32 
 times (assuming it's value is a 4-byte signed int,and is initialized to 0), 
 it would wrap around (or raise an exception for integer overflow). Probably 
 not what the user had in mind!

It's pretty irrelevant, because you wouldn't be using a stepper control for 
values in the billions. That'd be a poor UI. Just like if a table view had a 
couple billion rows in it in (in 32-bit) it would have broken as well. But it's 
a terrible thing to do in the first place. ;)


 Why didn't they just make the NSStepper a custom view that draws two arrows, 
 and has two sent actions that you can connect? Or even a variation of 
 NSMatrix with two button cells that look like arrows. That would avoid the 
 problem entirely, and be more intuitive to use.

Not really. The control's intended use is to increment and decrement a value. 
That's what it does. If you're not using the stepper for manipulating a numeric 
value, you should probably be using a different control.


--
Seth Willits


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Was: Re: NSStepper - useless?

2012-02-23 Thread Keary Suska
On Feb 23, 2012, at 10:05 AM, Kyle Sluder wrote:

 On Thu, Feb 23, 2012 at 6:16 AM, William Squires wsqui...@satx.rr.com wrote:
 From what I've read, the NSStepper has a bug (though practically, you'll 
 never see it); if one were to click the up or down arrow on the control 2^32 
 times (assuming it's value is a 4-byte signed int,and is initialized to 0), 
 it would wrap around (or raise an exception for integer overflow). Probably 
 not what the user had in mind! Why didn't they just make the NSStepper a 
 custom view that draws two arrows, and has two sent actions that you can 
 connect? Or even a variation of NSMatrix with two button cells that look 
 like arrows. That would avoid the problem entirely, and be more intuitive to 
 use.
 
 Because NSStepper is over 20 years old, dating back to when the way to
 push values around was to wire up a control's action to another
 control's -takeValueFrom: method. Besides, all sorts of crazy things
 tend to happen anyway when you try to use UINT_MAX for anything
 useful.


Not to mention that this is really a programmer error. If you don't wan the 
value to overflow, set a sensible maximum. A similar issue could happen from 
any user-entry field. It's the developer's responsibility (IMHO) to set data 
entry constraints.

Best,

Keary Suska
Esoteritech, Inc.
Demystifying technology for your home or business


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com