• 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: How to detect focus on an NSTextField
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to detect focus on an NSTextField


  • Subject: Re: How to detect focus on an NSTextField
  • From: Adam Gerson <email@hidden>
  • Date: Mon, 18 Feb 2008 03:41:18 -0500

Jens Alfke wrote:

On 8 Feb '08, at 1:56 AM, Joachim Deelen wrote:

what about NSWindow firstResponder? This Method returns the Object, that currently handles all Keyboard and Mouse Events at first.

The gotcha is that a text field /itself/ is never the first responder. Instead, the first responder is the window's fieldEditor, which is a shared NSTextView that's used to manage text editing in whichever text field (or text cell) is active.


What you need to do is check that the text field's currentEditor is non-nil, /and/ that the currentEditor itself is the window's firstResponder.

—Jens
I was able to check that the text field's currentEditor is non-nil by calling a method, but I want to kick off an action as soon as it becomes non nill (gets focus). Is there any way to detect this?

What is the syntax to determine if the currentEditor itself is the window's firstResponder?

How would I go about detecting a single click inside my NSTextField? That could solve this problem as well.


Thanks, Adam

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >How to detect focus on an NSTextField (From: Adam Gerson <email@hidden>)
 >Re: How to detect focus on an NSTextField (From: Joachim Deelen <email@hidden>)
 >Re: How to detect focus on an NSTextField (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Creating an CGAffineTransform From Sample Points
  • Next by Date: Re: Loading saved file into NSArrayController
  • Previous by thread: Re: How to detect focus on an NSTextField
  • Next by thread: Re: How to detect focus on an NSTextField
  • Index(es):
    • Date
    • Thread