• 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
NSTextView and setFont - bug or feature?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTextView and setFont - bug or feature?


  • Subject: NSTextView and setFont - bug or feature?
  • From: Chuck Norris <email@hidden>
  • Date: Wed, 17 Oct 2001 23:54:46 -0700

I have a NSTextView that is not editable. However, I want to be able to set the font programmatically. I'm finding, however, that setFont does not work unless the NSTextView is set editable. If I'm not mistaken, this behavior changed from 10.0.4 to 10.1, but that's beside the point except to indicate a possible bug has crept in.

There are two questions. One, how do I set the font of an uneditable NSTextView? It's kinda painful to do:

[myView setEditable: YES];
[myView setFont: aFont];
[myView setEditable: NO];

Plus, if I do this, the font change never seems to "take", probably because handling of the setFont is handled asynchronously somehow (interesting to note this, however - I wouldn't have thought it...). If I just set editable (and don't disable it), everything works great. If I wait long enough (probably allowing the event loop to cycle), I can disable editing again and the change "takes".

It seems a perfectly reasonable thing to want to set up a non-editable text view programmatically, so there either *must* be a different way, or this is really a bug.

The second question is, is this a bug or a feature? I say "bug" because it's perfectly reasonable to want to programmatically change the font of a non-editable NSTextView - it's only supposed to be non-editable to the *user*, not me the programmer. As long as changeFont messages are not honored, all is right with the world, seems to me. That's normally the only way the user changes fonts, if I'm not mistaken.

Chuck


  • Follow-Ups:
    • Re: NSTextView and setFont - bug or feature?
      • From: Douglas Davidson <email@hidden>
  • Prev by Date: Re: cocoa-dev digest, Vol 1 #731 - 16 msgs
  • Next by Date: Re: What happens to the AppKit Framework when an user logout ?
  • Previous by thread: Re: Problems with views (specifically NSSplitView)
  • Next by thread: Re: NSTextView and setFont - bug or feature?
  • Index(es):
    • Date
    • Thread