• 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: bindings and NSNumberFormatter
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bindings and NSNumberFormatter


  • Subject: Re: bindings and NSNumberFormatter
  • From: Francis Derive <email@hidden>
  • Date: Thu, 1 Dec 2005 15:07:21 +0100

Jeff,

I am not (yet:) great an expert, but my exercise did work fine - without the defect you mention.

I have an NSObjectController :
- the Info connection "content" is the model class to which it has been connected,
- the info Attributes has two keys ( one for the NSTextField in input, the other for another NSTextField in output ).

The model class has been instantiated with two outlets ( the two above NSTectField ).

The input NSTextField has its Info Bindings Value ( maxValue, minValue, value set to ( Bind to = NSObjectController, Controller key = selection, model key path = number )) where number is either an int or an NSNumber as an instance variable of the model class.
The output NSTextField Info Bindings has the same setting value set to ( Bind to = NSObjectController, Controller key = selection, model key path = number )

The input NSTextField has been provided with the Number formatter.
And the accessor methods are provided with the model class implementation ( below if NSNumber *number ) :

-(void) setNumber:(NSNumber *) val {
[val retain];
[number release];
number = val;
NSLog(@"setNumber %@", number);
}
-(NSNumber *) number {
NSLog(@"number %@", number);
return number;
}


What else ?

Hope it should help.

Francis.

On Nov 30, 2005, at 3:25 PM, Jeff Gilbert wrote:

Hey everybody,

I have an app with an NSTextField bound to a number in my model. The textfield has an NSNumberFormatter with the format for Zero set to an empty string. When I run the app, and the bound value is 0, if the focus leaves the textfield then it shows the grayed-out message "No Selection" rather than a blank field. If I change the Zero formatter to anything non-empty (even a single space) then that value shows up in the field after losing focus. Is this a defect, or is there any workaround?

thanks,
Jeff Gilbert

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

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
  • Follow-Ups:
    • Re: bindings and NSNumberFormatter
      • From: Jeff Gilbert <email@hidden>
  • Prev by Date: Re: NSTableView Restoring State
  • Next by Date: Re: bindings and NSNumberFormatter
  • Previous by thread: Cocoa trying to play a SMF midi file
  • Next by thread: Re: bindings and NSNumberFormatter
  • Index(es):
    • Date
    • Thread