Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > NSFormatter

NSFormatter
Thread Tools
Senior User
Join Date: Nov 2000
Status: Offline
Reply With Quote
May 20, 2001, 01:17 PM
 
For some reason I can't figure this out. I've subclassed it and added the 3 main/required methods but still can't figure out how this works.

Could someone either explain how it works or (better yet) just do a simple formatter subclass that turns everything blue or something?

Well, back to trial & error for now at least.

TIA!
     
IamBob  (op)
Senior User
Join Date: Nov 2000
Status: Offline
Reply With Quote
May 21, 2001, 10:42 AM
 
Well, I got it turning blue but only when all editing is done. I can't figure out how to make it use my attributed string for display after -isPartialStringValid.. is called.

So, if you can help, it would be much appreciated.

TIA, again!
     
IamBob  (op)
Senior User
Join Date: Nov 2000
Status: Offline
Reply With Quote
May 22, 2001, 04:05 PM
 
Moving this back to the top in hopes that someone knows how to do this.

I just need to get everything typed (or pasted, etc.) to show in blue (using an NSFormatter subclass). Okay, so it doesn't have to be blue - any NSAttributedString would do.

I've read the NSFormatter doc about 12 times, from top to bottom. I've tried everything I can think of.

Anyone?
     
Dedicated MacNNer
Join Date: Jan 2001
Location: Virginia, US
Status: Offline
Reply With Quote
May 23, 2001, 01:15 PM
 
I don't think you can use NSFormatter to use NSAttributedStrings while typing -- just basic NSStrings. The only NSAttributedString method is called when editing is done, as you saw.

Is there any reason you can't just call setTextColor: on the NSTextField or NSTextFieldCell? That should keep the text color while editing.

If you need to conditionally set the color while typing, you'll have to use the NSControl delegate methods.
     
IamBob  (op)
Senior User
Join Date: Nov 2000
Status: Offline
Reply With Quote
May 23, 2001, 02:23 PM
 
Hmm, that's kind of what I'd figured. Too bad.

Using setTextColor: wouldn't work. I need to be able to use graphics and multiple colors/styles in my formatting.

So, off to go read the NSControl docs (again ).

Thanks for the pointer!
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:11 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2