Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextInput protocol - 'unmarkText' is late?




On 12 Aug 2005, at 02:57, Jonathan del Strother wrote:

On 12 Aug 2005, at 02:41, Jonathan del Strother wrote:


I'm implementing my own text input control, and having some issues with marked text...


If I insert some marked text, I don't get informed of the next keypress. Only after a second keypress do I get the 'unmarkText' call, and then I receive key events as normal.


Say I want to insert an accented 'e', then t. The sequence of events is as follows (user input appears in brackets, NSTextInput functions being called are in square brackets)

(user presses Alt-e)
[setMarkedText] - has an apostrophe mark
(user presses e)
[insertText] - with é as the text
(user presses t)
[hasMarkedText] - since I haven't yet received 'unmarkText', I return YES. Nothing else happens
(user presses t again)
[hasMarkedText]
[unmarkText] - finally!
[insertText] - with t as the text.


Did that make sense? Basically, I think I should be receiving unmarkText as soon as the 'é' character is complete, whereas I'm receiving it 1 keypress too late, regardless whether that keypress is a letter, a delete key, whatever.

Am I returning the correct value for hasMarkedText? I'm currently storing a 'hasMark' boolean, which I'm setting to YES when I receive setMarkedText, and NO on unmarkText. Am I supposed to clear it whenever I receive an insertText event?



I forgot to mention - if I always return NO from hasMarkedText, the text control works perfectly. However, I'm a little wary of 'fixing' it this way, and was hoping for an answer on the proper way of doing things.




No ideas, anyone? _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >NSTextInput protocol - 'unmarkText' is late? (From: Jonathan del Strother <email@hidden>)
 >Re: NSTextInput protocol - 'unmarkText' is late? (From: Jonathan del Strother <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.