Re: Monitoring NSTextView Attributes
Re: Monitoring NSTextView Attributes
- Subject: Re: Monitoring NSTextView Attributes
- From: Douglas Davidson <email@hidden>
- Date: Tue, 11 Apr 2006 15:45:43 -0700
On Apr 11, 2006, at 1:56 PM, Scott Thompson wrote:
We have code that likes to monitor the current selection in an
NSTextView and update the attributes of a panel (text color,
background color, font size, things like that) as the user enters
text.
Our code is currently observing
NSTextStorageDidProcessEditingNotification and
NSTextViewDidChangeSelectionNotification. In response to those we
use calls like rangeForUserCharacterAttributeChange and
attributesAtIndex:effectiveRange: to figure out what attributes the
inspector should display.
The difficulty with this approach is that it seems to trip up
Japanese text entry. The glyphs that the user types go in, but at
the point where the user is supposed to be able to combine glyphs,
choose alternate forms, and things like that, we don't give them
that opportunity.
I guess one of the routines we use to discover the current
attributes is "ending" the inline editing session.
The issue is that rangeForUserCharacterAttributeChange usually is
used to determine a range over which to change character attributes,
and in order to do that properly inline editing needs to be ended.
One idiom you might try is
NSRange charRange = ([textView hasMarkedText] ? [textView
markedRange] : [textView rangeForUserCharacterAttributeChange]);
Douglas Davidson
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden