Re: NSStepper in Energy Saver in System Preferences?
Re: NSStepper in Energy Saver in System Preferences?
- Subject: Re: NSStepper in Energy Saver in System Preferences?
- From: Shawn Erickson <email@hidden>
- Date: Tue, 2 Dec 2003 09:56:33 -0800
On Dec 2, 2003, at 9:13 AM, Ron Ballesteros wrote:
I wanted to know how does the NSStepper in the Energy Saver in System
Preferences (Panther) determine which part of the time value is being
incremented or decremented? I wanted to know how by clicking on the
hour or minute the NSStepper appropriately knows which instance
variable to increment or decrement?
The NSStepper doesn't likely know anything. It is a view component, a
control. The controller that the NSStepper sends its actions to likely
knows what is being adjusted and updates the model as needed.
It appears to be all in one NSTextField with some kind of formatter I
take it?
I believe it is made of a few text fields placed next to each other or
a specialized sub-class but to know for sure...
Not quite sure?
You can crack open the nib for it and take a look (see in
/System/Library/PreferencePanes).
It looks to be a mix of a few view components all using custom classes.
A collection of three NSTextField subclasses, contained in a NSBox,
inside of a NSControl subclass.
The NSControl subclass knows about its stepper (likely to set its
current value and range as the target changes). The NSStepper sends its
action to the NSControl subclass. Also a controller object knows of the
stepper and is also a delegate of the NSControl subclass. Note that the
3 NSTextFields also have the NSControl subclass as a delegate. Draw
your own conclusions...
-Shawn
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.