Re: Finding which control is selected
Re: Finding which control is selected
- Subject: Re: Finding which control is selected
- From: Brian Webster <email@hidden>
- Date: Thu, 18 Oct 2001 14:39:05 -0500
On Thursday, October 18, 2001, at 02:14 PM, cocoa-dev-
email@hidden wrote:
What is the normal way of determining which control
in a window is currently selected (has input focus)?
I understand how to get the firstResponder for
the window, but how do I match that with a control?
The first responder _is_ the control (or more generally, the
NSView) with the input focus. If you want to see if the first
responder is equal to a certain control (i.e. one of your
outlets), just use ==. The only place where this doesn't work
is with NSTextField. When an NSTextField is selected, the
window's field editor becomes the first responder, not the text
field itself.
--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster