Re: NSTextView and setFont - bug or feature?
Re: NSTextView and setFont - bug or feature?
- Subject: Re: NSTextView and setFont - bug or feature?
- From: Ali Ozer <email@hidden>
- Date: Thu, 18 Oct 2001 11:36:37 -0700
There is that change in 10.1 where
shouldChangeTextInRange:replacementString: now returns NO for
non-editable textviews (see relnotes), but as Doug says, setFont: is not
an user action and does not go through this method. User actions such as
changeFont:, changeColor:, insertText:, etc do.
Do you by any chance have a setFont: override that calls this method?
Ali
On Thursday, October 18, 2001, at 10:42 AM, Douglas Davidson wrote:
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
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev