How can I determine whether an NSSearchField/NSTextField has input focus?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The previous answer is wrong, because
NSTextField/NSSearchFielddo not themselves become the first responder and handle edited text. Instead, they use the window’s field editor, which is anNSTextViewthat is shared between all fields on the window (since only one of them can have focus at a time).You need to see if the first responder is an
NSText, and if so, if the search field / text field is its delegate.