• 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: resignFirstResponder called immediately
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: resignFirstResponder called immediately


  • Subject: Re: resignFirstResponder called immediately
  • From: Donald Hall <email@hidden>
  • Date: Thu, 8 Apr 2004 00:10:48 -0600

Louis,

Thanks for the response. The first thing I tried was the delegate method '- textShouldBeginEditing:', but that only gets called if you actually attempt to make a change. What I want is to do something when the text field becomes the first responder, which is why I subclassed to override becomeFirstResponder.

I wonder if the text field upon becoming first responder immediately resigns in favor of the field editor. This would give the behavior I have observed (resignFirstResponder being called immediately, not when the text field loses focus).

'- textShouldEndEditing:' looks to be triggered when the insertion point leaves the text field, so I think I can use this to do what I want and not worry about resignFirstResponder.

Regards,

Don

Hello....

When a text field is being edited, the shared "field editor" object is used as the first responder, not the text field. Check out the documentation for the NSWindow method fieldEditor:forObject: for more information on this.

Depending on what you are trying to do, you also might want to look at using the delegate methods provided by NSTextField (or the equivalent NSControl delegate methods) instead:

- textShouldBeginEditing:
- textDidBeginEditing:
- textDidChange:
- textShouldEndEditing:
- textDidEndEditing:


Hope that helps,

Louis

...

When I tab into one of these text fields I get both messages:

2004-04-07 00:02:22.712 MyApp[8922] becomeFirstResponder
2004-04-07 00:02:22.740 MyApp[8922] resignFirstResponder

When I tab out, I get no messages.

The panel containing the text field remains key (frontmost).

Can anyone explain this? It looks like I am doing the same thing as
in Anguish et al page 586.

Thanks,

Don


--
Donald S. Hall, Ph.D.
Apps & More Software Design, Inc.
email@hidden
http://www.appsandmore.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.


References: 
 >resignFirstResponder called immediately (From: Donald Hall <email@hidden>)
 >Re: resignFirstResponder called immediately (From: "Louis C. Sacha" <email@hidden>)

  • Prev by Date: Suggestions on alignment of NSAttributedString in NSView
  • Next by Date: Re: NSPanel as Sheet and controlling the run loop
  • Previous by thread: Re: resignFirstResponder called immediately
  • Next by thread: Send Email with "deliverMessage"
  • Index(es):
    • Date
    • Thread