• 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: NSTextField allowing only numbers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextField allowing only numbers


  • Subject: Re: NSTextField allowing only numbers
  • From: Daniel Todd Currie <email@hidden>
  • Date: Sat, 23 Oct 2004 11:20:35 +0900

Check the docs for NSFormatter.


On 2004 Oct 23, at 04:41, Michael Becker wrote:

Hello all!

I have an NSTextField and I want it to only accept numbers as input. If the user tries to enter any other character than a digit, nothing should happen.
But somehow I cannot find the right way to do that.
I've tried -controlTextDidChange:, this way I can tell whether the user entered an unwanted character, but I cannot prevent them from doing so.
And -control:textShouldBeginEditing: is only called for the first character the user inputs, so this doesn't work either.

How do I go about this?

Bye,
Michael

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
References: 
 >NSTextField allowing only numbers (From: Michael Becker <email@hidden>)

  • Prev by Date: How to disable/gray an NSTextfield (used as static text)
  • Next by Date: Re: How to disable/gray an NSTextfield (used as static text)
  • Previous by thread: NSTextField allowing only numbers
  • Next by thread: Creating a Custom Formatter
  • Index(es):
    • Date
    • Thread