0

How can I know when an NSTextField has rec'd focus?

Is there a delegate method that will tell me when the user has clicked the mouse in (or otherwise selected) my NSTextField?

thanks

tom

kennytm
  • 510,854
  • 105
  • 1,084
  • 1,005
TomH
  • 2,950
  • 2
  • 26
  • 49

1 Answers1

2

Subclass NSTextField and override -becomeFirstResponder.

Mike Abdullah
  • 14,933
  • 2
  • 50
  • 75
  • Thanks Mike -- I was hoping/guessing that the NSTextField might send out a notification when it became the first responder. – TomH Jan 28 '10 at 17:56
  • Mike, `-becomeFirstResponder` of `NSTextField` [isn't available since Mac OS X v10.5](http://developer.apple.com/library/mac/#documentation/cocoa/reference/ApplicationKit/Classes/NSTextView_Class/DeprecationAppendix/AppendixADeprecatedAPI.html). – dzolanta Apr 09 '11 at 16:06
  • Deprecation ≠ "isn't available". Also, `becomeFirstResponder` is declared in `NSResponder`; what the deprecation is saying is that it's not OK to *call* this method. Subclassing it is fine. – Nicholas Riley Apr 09 '11 at 16:34