Re: Another try: removing the focus from an NSTextField
Re: Another try: removing the focus from an NSTextField
- Subject: Re: Another try: removing the focus from an NSTextField
- From: Matt Neuburg <email@hidden>
- Date: Thu, 8 Aug 2002 18:05:18 -0700
At 10:44 PM +0200 8/8/02, thus spake Marco Binder:
>
Do you know why it wont work within the NSTextfield4s target4s action
>
method? Or in the controlTextDidEndEditing: delegate method?
It does work, but it doesn't have any effect. The fact is that the
firstResponder is *already* the window by the time you start to interfere,
so setting it to the window does nothing of any interest. The reason is
that you're interfering at too high a level. After you finish doing
whatever you do, Cocoa goes ahead and finishes what *it* was doing,
including setting the firstResponder the way *it* wants it. The target
action and controlTextDidEndEditing: are essentially just notifications -
you're being told what stage things are at, so you can perform other
related clean-up, but you're not in a position to interfere with the
process itself.
>
Your solution
>
is perfectly functional, but still it seems kind of far fetched
Not really. If you read the manual (on
control:textView:doCommandBySelector: ) you'll see that this is exactly
what you're expected to do. You're wishing to interfere with Cocoa's normal
way of doing things so you need to block Cocoa's "react to the user typing
Return" behavior before it even gets started, rather than trying to change
that behavior in the middle. This is how you do that. m.
--
matt neuburg, phd = email@hidden,
http://www.tidbits.com/matt
pantes anthropoi tou eidenai oregontai phusei
Subscribe to TidBITS! It's free and smart.
http://www.tidbits.com/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.