• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSTextInput protocol - 'unmarkText' is late?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextInput protocol - 'unmarkText' is late?


  • Subject: Re: NSTextInput protocol - 'unmarkText' is late?
  • From: Jonathan del Strother <email@hidden>
  • Date: Wed, 24 Aug 2005 16:34:30 +0100

Thanks for the confirmation.

On 22 Aug 2005, at 19:06, Aki Inoue wrote:

Jonathan,

The marked range should be treated as if it is a selection.

So, whenever you receive -insertText:, you need to replace the range and clear the marking state.


(user presses Alt-e)
[setMarkedText]  - has an apostrophe mark
(user presses e)
[insertText] - with é as the text

Unmarking is implied here, and you need to reset your internal flag.

Aki



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:
This email sent to email@hidden





_______________________________________________ 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
References: 
 >NSTextInput protocol - 'unmarkText' is late? (From: Jonathan del Strother <email@hidden>)
 >Re: NSTextInput protocol - 'unmarkText' is late? (From: Jonathan del Strother <email@hidden>)
 >Re: NSTextInput protocol - 'unmarkText' is late? (From: Jonathan del Strother <email@hidden>)
 >Re: NSTextInput protocol - 'unmarkText' is late? (From: Aki Inoue <email@hidden>)

  • Prev by Date: Re: Superscript causing crash
  • Next by Date: RE: MiscKit, MOKit, etc.
  • Previous by thread: Re: NSTextInput protocol - 'unmarkText' is late?
  • Next by thread: NSToolbar - dynamic button addition
  • Index(es):
    • Date
    • Thread