• 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
What am I missing?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

What am I missing?


  • Subject: What am I missing?
  • From: Darkshadow <email@hidden>
  • Date: Wed, 3 Oct 2001 13:51:46 -0400

(sorry if this is a double post, accidentally sent it from the wrong email addy)

I'm trying to set up my preferences windw to allow users to choose a font. However, I'm not able to get the font to change. I hit the button, chooseOne: gets called, which sets up the font manager and tells it to open the font panel, but clicking on any font in the panel doesn't do a single thing. It should be calling changeFont:. I tried adding setDelegate to NSFontManager, but that didn't help. Tried a couple of the other things in the docs for NSFontManager & NSFontPanel, but none of them seem to be working out.

Hope somebody can figure out what I'm doing wrong. Hopefully something easy, this is my first brush with NSFontManager.

Here's my small bit of code. Haven't done much with it as it's more or less "test" code:

- (IBAction)chooseOne:(id)sender
{
NSFont *panelFont;

[[NSFontManager sharedFontManager] setSelectedFont:[NSFont fontWithName:[fontOne stringValue] size:0.0] isMultiple:NO];
[[NSFontManager sharedFontManager] orderFrontFontPanel:self];
/* did this next part to see if it was actually selecting the right font - it is.
Only gives me what the font panel opens up with, nothing after.
(Didn't expect it to) */
panelFont = [[NSFontManager sharedFontManager] convertFont:[[NSFontManager sharedFontManager] selectedFont]];
NSLog(@"%@\n",[panelFont fontName]);
}

- (void)changeFont:(id)sender
{
NSFont *oldFont;
NSFont *newFont;

//never gets called
NSLog(@"I'm being called");

oldFont=[NSFont userFontOfSize:-1.0];
newFont=[sender convertFont:oldFont];

[fontOne setStringValue:[NSString stringWithFormat:@"%@",[newFont fontName]]];
}

Darkshadow (aka Mike)


  • Prev by Date: Re: Docklet(ing) API & 10.1: Where ????
  • Next by Date: Re: know if an application need all the screen.
  • Previous by thread: Re: Distinct action messages from matrix of NSButtonCells
  • Next by thread: Bug in NSColorPanel/NSColorPicker?
  • Index(es):
    • Date
    • Thread