Re: Finding which control is selected
Re: Finding which control is selected
- Subject: Re: Finding which control is selected
- From: Douglas Davidson <email@hidden>
- Date: Thu, 18 Oct 2001 15:42:57 -0700
On Thursday, October 18, 2001, at 01:38 PM, Brian Webster wrote:
Probably the best way to go about this is to hook up your appropriate
controller object as the delegate of both text fields and implement the
controlTextDidBeginEditing: and controlTextDidEndEditing: methods. The
single argument is an NSNotification, and the notification's object
will be the NSTextField that has just gained or lost the focus. You
can use this to keep track of which text field (if any) is being edited
at any given time.
You don't have to be the delegate to do this--any object can register
for these notifications. You can register for the
NSControlTextDidBeginEditingNotification for particular controls, or
just register to receive it for any control. That's the programmatic
way to do it.
If you're in the debugger, and trying to figure out who has focus, try
looking at the field editor's delegate.
Douglas Davidson