• 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: Peter Sichel <email@hidden>
  • Date: Thu, 18 Oct 2001 16:32:34 -0400

Thanks of your response. Here's what I'm trying to do.

I have a window with two NSTextFields. When the user clicks
on a button in the window, I want to determine which of the
two NSTextFields has input focus.

[window firstResponder] is equal to the window itself, so doesn't help.
[window fieldEditor: forObject:] returns the field editor, but
this doesn't appear to tell me which control has input focus.

What am I missing?

- Peter

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.

--


  • Follow-Ups:
    • Re: Finding which control is selected
      • From: Brian Webster <email@hidden>
References: 
 >Re: Finding which control is selected (From: Brian Webster <email@hidden>)

  • Prev by Date: Re: problem displaying html in NSTextView...
  • Next by Date: Re: Finding which control is selected
  • Previous by thread: Re: Finding which control is selected
  • Next by thread: Re: Finding which control is selected
  • Index(es):
    • Date
    • Thread