Re: NSFont errors
Re: NSFont errors
- Subject: Re: NSFont errors
- From: John Randolph <email@hidden>
- Date: Fri, 25 Jul 2003 12:42:44 -0700
On Friday, July 25, 2003, at 11:26 AM, Francisco Tolmasky wrote:
Ok, so I'm trying to have the font preference changed when a font gets
changed in the font panel, I have changeFont: working, and it looks
something like this:
- (void)changeFont:(id)sender
{
NSFont *theFont= [sender convertFont: [fontTextField font]];
[[[NSUserDefaults standardUserDefaults] setObject: theFont forKey:
FontPrefKey];
//...stuff
}
But for some reason I get an error like this:
*** -[NSUserDefaults setObject:forKey:]: Attempt to insert
non-property value '"CGS Monaco 10.00 pt. P [] (0x01d52480)
fobj=0x0029b020, spc=6.00"' of class 'NSCGSFont'.
I have no idea what's going wrong, anyone know?
The problem here is that you're trying to store the font object itself
(not its name) in the user defaults database. The user defaults
dictionary differs from ordinary NSMutableDictionary objects in that it
will only accept objects that can be represented as a property list.
-jcr
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: | |
| >NSFont errors (From: Francisco Tolmasky <email@hidden>) |