Re: Programmatically switching text fields
Re: Programmatically switching text fields
- Subject: Re: Programmatically switching text fields
- From: Graham Cox <email@hidden>
- Date: Tue, 04 Aug 2015 08:51:48 +1000
> On 4 Aug 2015, at 12:17 am, Alex Zavatone <email@hidden> wrote:
>
> Why not store all your references in an array (a little lookup table), then set the firstResponder to the reference from the index of the object in the array + 1 and roll over to index 0 if the index is past the count of the array?
>
But why? Views already have a perfectly servicable mechanism for linking a series of fields (or any other items) in a sequence, called the ‘nextKeyView’ outlet.
The problem I’m having is not determining which field to select, but making it actually select so that the user can type into it without needing it to be clicked again, despite showing the focus ring.
> Shouldn't it be [self makeFirstResponder:myTextFieldRef]?
This code is in a NSWindowController, not a NSWindow. While that is a NSResponder subclass and does respond to the message, it’s the window that selects among its subviews - at least that’s how I’ve always written code like this. I will check whether doing this makes any difference though.
—Graham
_______________________________________________
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