Re: Subclassing NSTextView and characters with diacritical marks
Re: Subclassing NSTextView and characters with diacritical marks
- Subject: Re: Subclassing NSTextView and characters with diacritical marks
- From: Jeff Cruikshank <email@hidden>
- Date: Fri, 15 Jun 2001 13:11:20 -0700
Thanks Aki and others who had helpful suggestions. I had previously gone
down the NSTextField route, but in order to get the necessary
functionality, I had to create a custom NSFormatter, and an NSTextView
to use as the field editor. This wasn't horrible, but it meant that the
three classes (my custom NSTextField included) had to share data, or
communicate with each other. All things considered, writing a single
NSTextView class was the way to go.
For those who might be struggling with similar problems, I was able to
disable the the display of the diacritical marks by overriding
-[NSTextView setMarkedText:range:]. This didn't solve the whole problem,
because after overriding this method, entering an acute accent would
would modify all characters subsequently entered. So, if I typed i,
typing an 'a' afterward would produce a. All characters would be
modified in this way until something else became the first responder. I
figured that this must have something to do with -[NSInputManager
markedTextAbandoned], so in my keyDown method, I would check a flag to
determine if the key is supposed to be modified (I set this flag in
-[NSTextView setMarkedText:range]), and if not, I would call
[[NSInputManager currentInputManager] markedTextAbandoned:self]. That
did it.
Thanks again!
Jeff
On Thursday, June 14, 2001, at 12:16 PM, Aki Inoue wrote:
Jeff,
OK, in that case, you should be able to override -setMarkedText:range: .
What kind of problem do you have ? With a simple test app, I don't see
any problem with it.
Of course, it's going to disable inputting east asian languages like
Japanese or Korean, though.
Aki
On 2001.06.13, at 18:06, Jeff Cruikshank wrote:
Hi Aki,
My NSTextView subclass has two modes of display; hidden and visible.
When editing in hidden mode, each character entered is displayed as a
random sequence of white-space characters. Editing in visible mode is
the same as editing in a stock NSTextView. The idea is to prevent
someone from determining the length or content of the edited text, but
if the diacritical marks show up, that instantly gives an observer a
clue about the nature of the edited text.
Correct me if I'm wrong, but if I simply prevent keyDown from calling
interpretKeyEvents, won't that bypass the TSM? I realize this isn't
very friendly, but I know of no other solution.
Thanks!
Jeff
On Wednesday, June 13, 2001, at 10:42 AM, Aki Inoue wrote:
Jeff,
The marked deadkey display is tightly coupled with the processing in
TSM.
Currently there is no way to de-couple them easily.
Besides, it is part of, not yet officially documented, Aqua guideline.
Could you give me some more info why you need to disable it ?
Thanks,
Aki
On 2001.06.11, at 18:56, Jeff Cruikshank wrote:
I'm having some problems with diacritical marks in my NSTextView
subclass. I would like to have full control over which characters
are displayed in my view, but despite my many attempts, I can't
fully control the display of these diacritical marks (they just keep
displaying regardless of how hard I try to prevent them from popping
up). In particular, when adding i (option-e + e) to my view, I would
like it to discard the initial keystroke and only display the
composite character (after the second 'e' is typed). I've looked at
the NSTextInput protocol, and setMarkedText:range: looks promising,
but simply overriding it and having it do nothing seems to cause
problems when the composite character is supposed to be added.
Can someone shed some light on how I can prevent these marks from
drawing in my view?
Thanks in advance,
Jeff
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev