MacErudite Mac Forums Forum Index
  

NSNumberFormatter Q

 
Post new topic    MacErudite Mac Forums Forum Index -> General Programming
View previous topic :: View next topic  
Sponsored Links
Lorenzo Thurman
Guest





 PostPosted: Tue Jul 03, 2007 4:12 pm    Post subject: NSNumberFormatter Q Back to top

I'm using a couple of formatters in my app setup via IB to keep values within a range. This works, and when an out of range value is entered, I get the dialog box explaining the error. How do I override the default and provide my own? I've gone through the docs for NSNumberFormatter, but can't figure it out. Can someone give me a pointer? TIA
 
Nick Tamburri
Guest





 PostPosted: Thu Jul 05, 2007 7:58 pm    Post subject: Re: NSNumberFormatter Q Back to top

Lorenzo Thurman <lorenzo@diespammerhethurmans.com> writes:

Quote:
I'm using a couple of formatters in my app setup via IB to keep values within a range. This works, and when an out of range value is entered, I get the dialog box explaining the error. How do I override the default and provide my own? I've gone through the docs for NSNumberFormatter, but can't figure it out. Can someone give me a pointer?

I believe you want to look at the delegate methods of NSControl.
For your purpose you have to set a delegate for the controller that the NSNumberFormatter is attached to. That delegate must implement the method control:didFailToValidatePartialString:errorDescription:
Hope that helps.

/nt
 
Lorenzo Thurman
Guest





 PostPosted: Thu Jul 05, 2007 11:11 pm    Post subject: Re: NSNumberFormatter Q Back to top

Nick Tamburri wrote:

Quote:
Lorenzo Thurman <lorenzo@diespammerhethurmans.com> writes:

Quote:
I'm using a couple of formatters in my app setup via IB to keep values within a range. This works, and when an out of range value is entered, I get the dialog box explaining the error. How do I override the default and provide my own? I've gone through the docs for NSNumberFormatter, but can't figure it out. Can someone give me a pointer?

I believe you want to look at the delegate methods of NSControl.
For your purpose you have to set a delegate for the controller that the NSNumberFormatter is attached to. That delegate must implement the method control:didFailToValidatePartialString:errorDescription:
Hope that helps.

/nt

Thanks for the reply. I'm going over the Data Formatting docs again and things are getting clearer the second time through.
 
Display posts from previous:   
Post new topic    MacErudite Mac Forums Forum Index -> General Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum