• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSStepper - How can I tell which arrow has been clicked?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSStepper - How can I tell which arrow has been clicked?


  • Subject: Re: NSStepper - How can I tell which arrow has been clicked?
  • From: Matt Majka <email@hidden>
  • Date: Sat, 20 Apr 2002 09:52:48 -0600

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.

Any ideas? The documentation on this topic is pretty much worthless.

In your awakeFromNib method, make sure that the text field
and stepper have the same values.

[textField setFloatValue: initialValue];
[stepper setFloatValue: initialValue];

In the target action of your stepper:

[textField setFloatValue:[sender floatValue]];

In the target action of your text field:

[stepper setFloatValue:[sender floatValue]];

This keeps both the stepper and text field in synch anytime
the users uses one or the other. This way you don't have to
care which arrow was pressed. I also wouldn't trash this
documentation. Both the NSTextField and NSStepper inherit
from NSControl. You just need to see what capabilities are
available and then decide how best to accomplish what you
want to do.
_______________________________________________
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.

References: 
 >Re: NSStepper - How can I tell which arrow has been clicked? (From: Esteban <email@hidden>)

  • Prev by Date: Simple Exception Handler - Revelation part Deux
  • Next by Date: XY Graph
  • Previous by thread: Re: NSStepper - How can I tell which arrow has been clicked?
  • Next by thread: Re: NSStepper - How can I tell which arrow has been clicked?
  • Index(es):
    • Date
    • Thread