Re: Multi-keystroke text input issue
Re: Multi-keystroke text input issue
- Subject: Re: Multi-keystroke text input issue
- From: Gideon King <email@hidden>
- Date: Wed, 10 Nov 2004 10:57:41 +1000
Brilliant, thanks. Exactly what I needed. In case anyone else needs to
do the same thing, I also needed to add the following to my NSTextView
subclass:
- (void)insertText:(id)aString {
if ([self hasMarkedText]) {
// This causes the marking to be removed, which means that the
insertText method is called
// again without the text marked, which goes through the normal
insertion channels.
[self unmarkText];
return;
}
[super insertText:aString];
}
Gideon
On 09/11/2004, at 11:02 PM, Satoshi Matsumoto wrote:
Hi Gideon,
on 04.11.9 8:44 PM, Gideon King wrote:
I have a case where I need to regenerate a text view after each
keystroke (in textView:shouldChangeTextInRange:replacementString:) and
reset the text using the text storage's setAttributedString: method.
This works fine in English, but when users are entering text which
requires multiple keystrokes for generation of a single character
(e.g.
in using Hirgana input), the call to the shouldChangeTextInRange...
method is sent for every keystroke even if a full character has not
been composed yet.
How do I pick up that I don't have a full character yet so I can allow
the textview to display the partially composed character?
You can check it using NSTextInput protocol
- (BOOL)hasMarkedText
Returns YES if the receiver has marked text, NO if it doesn’t. Unlike
other
methods in this protocol, this one is not called by an input server.
The
text view itself may call this method to determine whether there
currently
is marked text. NSTextView, for example, disables the Edit>Copy menu
item
when this method returns YES.
Hope that helps.
Satoshi Matsumoto
_______________________________________________
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