Re: setting the increment of all steppers
Re: setting the increment of all steppers
- Subject: Re: setting the increment of all steppers
- From: Dan Waylonis <email@hidden>
- Date: Tue, 21 Oct 2003 09:55:22 -0700
On Oct 21, 2003, at 9:01 AM, Jeff Childers wrote:
>
I have some code that registers if the option key is pressed and
>
released. when the option key is down I want to set All the steppers
>
to 10 when it is released set them all to 1.
>
>
is there a easy way to change all of the steppers at once. [...]
Hi Jeff,
Probably not "easy", but do-able in at least two ways (off of the top
of my head):
1: Depending on what your doing, you'd probably want one of: all
windows, key window, main window, or modal window. You can get those
with [NSApp windows], [NSApp keyWindow], [NSApp mainWindow], and [NSApp
modalWindow] respectively.
Then, for each window, get the content view, using [<NSWindow>
contentView]. For each child of the content view (from [<NSView>
subviews], check if the view is a class (or derived class) of NSStepper
by checking [<subview> isKindOfClass:[NSStepper class]]. If so, change
the increment using [<stepper> setIncrement:<value>].
If the total # of steppers doesn't change in your application, you
might consider doing the above steps once, and cache the list of known
NSSteppers in an NSArray. That way, in the future, you can just go
through that list and change the increment values.
2: Subclass NSStepper. Create a new method to setAlternateIncrement:.
Override mouseDown:, checking if the NSAlternateKeyMask is set. If
so, use the alternate increment value.
Dan
_________________________________________________
Dan Waylonis email@hidden
Software Engineer
http://www.nekotech.com
nekotech SOFTWARE 650.964.2490 (O)
_______________________________________________
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.