Re: NSStepper - How can I tell which arrow has been clicked?
Re: NSStepper - How can I tell which arrow has been clicked?
- Subject: Re: NSStepper - How can I tell which arrow has been clicked?
- From: Joe Morris <email@hidden>
- Date: Sat, 20 Apr 2002 15:38:32 -0400
The reason it is more complicated for me is that the NSSteppers don't
have an associated text field - I'm using them as up/down buttons that
apply to whatever table row is currently highlighted. So I needed to
trap the action, figure out what was going on, and then apply the value
to the value in whatever row is highlighted right now. Does that answer
your question?
-Joe
On Saturday, April 20, 2002, at 12:00 PM, Matt Majka wrote:
Why don't you initialize all three steppers to the value
of your "another value", the use the -setIncrement method
to set the step increment for your steppers to one, five,
and ten respectively. Then they all can call the same
method and you don't have to care which arrow was pressed.
On Friday, April 19, 2002, at 11:32 pm, Joe Morris wrote:
I have implemented NSSteppers as incrementers/decrementers, which
makes it important to know which arrow was clicked (I'm applying the
up/down to another value, so the current value of the NSStepper isn't
too useful). The way I've succeeded in getting them to work is to set
their initial values to 0, and then the increment to +/- 1 or whatever
increment you want. Then in the action method I check their value, do
an action depending on it, and then set their value back to 0. An
advantage of this implementation is that I have 3 NSSteppers all
calling the same function - one for +/- 1, 5, and 10. I just add the
current value of the sending NSStepper to the value before setting the
NSStepper back to 0. Works pretty well.
Now the only problem I have is that they don't seem to be able to be
resized - very frustrating! I really want to about double their size
in both dimensions... anyone know any way to do this, or would I have
to resort to two buttons for each NSStepper, each with their own
action method (ugh!)?
-Joe
On Saturday, April 20, 2002, at 12:39 AM, Graeme Hiebert wrote:
On Friday, April 19, 2002, at 02:46 PM, Julian Barkway wrote:
I have set up an NSStepper (or the 'little arrows' that allow you to
increment/decrement a number in a related text field) and I have to
admit to being stumped with regards to getting the action back. Yes,
I can get IB to invoke my action method when the stepper is clicked
but I suspect that this won't tell me whether it's the up or down
arrow specifically that's been clicked.
Do you have to know whether it was the "up" or "down" that was
clicked? Why not just set the min/max/increment of the stepper to a
range that makes sense for your use, and then get its intValue when
it is pressed?
I can't think of too many situations where I'd have to know whether
the "up" or "down" was actually pressed.
-g
_______________________________________________
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.
_______________________________________________
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.
_______________________________________________
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.