• 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: Finding which control is selected
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Finding which control is selected
      • From: Peter Sichel <email@hidden>
  • Prev by Date: Drawing Glyphs one by one
  • Next by Date: Re: Help with pasteboard
  • Previous by thread: Finding which control is selected
  • Next by thread: Re: Finding which control is selected
  • Index(es):
    • Date
    • Thread