• 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
Force redisplay of NSTextField after NSFormatter subclass change
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Force redisplay of NSTextField after NSFormatter subclass change


  • Subject: Force redisplay of NSTextField after NSFormatter subclass change
  • From: Jonathan Fewtrell <email@hidden>
  • Date: Tue, 27 Nov 2007 16:27:23 +0000

I have an NSTextField bound to a certain key in a Core Data model entity. A switch in the interface allows the user to display the value in either of two formats. The formats are quite different, so I have two different NSFormatter subclasses and I set the appropriate one when the user toggles the switch. I find that the displayed value immediately after a switch is spurious, So I want to force the field to redisplay. Nothing I try seems to get it to redisplay. I have tried the following:

sending -setNeedsDisplay: to the field
sending -display to the field
setting the field hidden and then unhidden
sending a -willChangeValueForKey: / -didChangeValueForKey; pair to the model object


It appears that because the underlying value of the key (which is an NSNumber) does not change, the field refuses to update. The only way I can get it to work is to change the value of the key and change it back again. But this seems a clumsy hack. Is there a better way?
_______________________________________________


Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: Archived QTMovieViews on 64-bit?
  • Next by Date: Re: Archived QTMovieViews on 64-bit?
  • Previous by thread: Re: Code and Decode a CGContextRef
  • Next by thread: Re: Force redisplay of NSTextField after NSFormatter subclass change
  • Index(es):
    • Date
    • Thread