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: Text Input problems



Dominik,

-unmarkText is usually used by non text input events such as selection change, resigning first responder, etc.

What you're looking for is a way to distinguish - textView:shouldChangeTextInRange:replacementString: invocation from within -insertText:. So, instead of -unmarkText, you can do the similar trick to -insertText:.

Aki

Hi all,

I have the following problem: In SubEthaEdit I need to know if we are composing characters in the textviews textView:shouldChangeTextInRange:replacementString: to know if I have to check the encoding of the inserted string. NSTextView's hasMarkedText helps here, but the problem is it also returns true when it is in the act of umarking. However I need to know this, because only then the text gets inserted permanently into the textstorage, and on that occasion i have to check.

For this i tried to wrap the unmarkText method in my NSTextView subclass like this:

- (void)unmarkText {
	I_isUnmarking = YES;
	[super unmarkText];
	I_isUnmarking = NO;
}

however, after not working and adding some nslogs and debug symbols this method didn't get called at all. This seemed very odd to me, because when breakpointing inside my textView:shouldChangeTextInRange:replacementString: -[NSTextView unmarkText] was an the callstack.

If anyone can explain to me, why this didn't work, I'd appreciate it greatly.

On a sidenote, using magic hat, i found that the internal method _isUnmarking does exactly what i need. I'd be happy if this method would be exposed, because in my case I really need it.

Best,
  dom

--
Dominik Wagner          Mail: email@hidden
TheCodingMonkeys        http://www.codingmonkeys.de/
Blog - DasGenie: !Scrap http://scrap.dasgenie.com/

_______________________________________________
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

_______________________________________________ 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: 
 >Text Input problems (From: Dominik Wagner <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.