Re: NSTextView and setFont - bug or feature?
Re: NSTextView and setFont - bug or feature?
- Subject: Re: NSTextView and setFont - bug or feature?
- From: Douglas Davidson <email@hidden>
- Date: Thu, 18 Oct 2001 10:42:27 -0700
On Wednesday, October 17, 2001, at 11:54 PM, Chuck Norris wrote:
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".
NSTextView's setFont: method really does little more than set the font
on the text storage and in the typing attributes, so this seems
surprising to me. I just built a simple example, and wasn't able to
reproduce this. Have you tried operating on the text storage directly?
Can you reduce this to a minimal test case?
Douglas Davidson