Re: Finding the active NSTextField
Re: Finding the active NSTextField
- Subject: Re: Finding the active NSTextField
- From: Daniel Todd Currie <email@hidden>
- Date: Sun, 12 Sep 2004 12:31:21 -0700
You could try something like:
id anObject = [theWindow firstResponder];
if([anObject respondsToSelector:@selector(isFieldEditor)])
{
if([anObject isFieldEditor])
{
id activeTextField = [[theWindow firstResponder] delegate];
}
}
The first responder for an active text field will always be its field
editor. Hope this helps,
-- DTC
On 2004 Sep 10, at 10:57, David Catmull wrote:
How do I find which NSTextField has user focus in my window? I tried
using NSWindow's firstResponder method, but that just gave me the
window back. Searching the archives, I found a post suggesting
NSControl's currentEditor, but that just returned nil.
My window has a pair of radio buttons which controls whether two text
fields are active. If one of those two has user focus when they are
deactivated, I want to move the focus to another field that's always
active.
--
David Catmull
email@hidden
http://www.uncommonplace.com/
[demime 0.98b removed an attachment of type
application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden