Problems with starting editing outline view with Chinese marked text and diacriticals
Problems with starting editing outline view with Chinese marked text and diacriticals
- Subject: Problems with starting editing outline view with Chinese marked text and diacriticals
- From: Gideon King <email@hidden>
- Date: Tue, 28 Sep 2010 11:00:40 +1000
Hi everyone, I have an outline view where I want to set things up so that when the user starts typing, it both starts editing and replaces the contents of the selected row with the typed character. Here is what I have been using:
- (void)insertText:(id)aString {
if ([self selectedRow] == -1) {
return;
}
NSInteger textColumnNumber = [[self tableColumns] indexOfObject:[self tableColumnWithIdentifier:@"Outline"]];
[self editColumn:textColumnNumber row:[self selectedRow] withEvent:nil select:YES];
[[self currentEditor] insertText:aString];
}
This works fine for ASCII text, when my customers switch to Pinyin or other multi-byte languages, it doesn't pick up the first character as marked text, and as I continue typing, the character completions only show up on the second character on.
Also, it doesn't accept diacriticals to start the editing.
So I thought that I would try implementing the NSTextInputClient protocol in my NSOutlineView subclass and see if I could get it working that way. I tried all sorts of things for handling the marked text. The following is my current attempt:
- (void)setMarkedText:(id)aString selectedRange:(NSRange)newSelection replacementRange:(NSRange)replacementRange {
if ([self selectedRow] == -1) {
return;
}
NSInteger textColumnNumber = [[self tableColumns] indexOfObject:[self tableColumnWithIdentifier:@"Outline"]];
[self editColumn:textColumnNumber row:[self selectedRow] withEvent:nil select:YES];
NSTextView *currentEditor = (NSTextView *)[self currentEditor];
[currentEditor setMarkedText:aString selectedRange:newSelection];
}
This starts the editing, and displays the character that was typed, with the underline indicating that it is being composed, but it doesn't show the completions panel.
Also I still haven't worked out how to get it to start editing on entry of a diacritical. I suspect it may have something to do with validAttributesForMarkedText, but am not sure...
So, two questions:
1. How can I get the editing started *and* show the completions panel for multi-byte languages (I am currently testing using Pinyin simplified, which shows the problem all the time)?
2. How can I start editing when someone presses a key for a diacritical (e.g. Option+e)?
Thanks
Gideon_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden