Re: First responder not coming back to container after editing with NSTextField
Re: First responder not coming back to container after editing with NSTextField
- Subject: Re: First responder not coming back to container after editing with NSTextField
- From: email@hidden
- Date: Tue, 29 Sep 2015 20:14:24 +0900
So at that event or at the beginning of it resign first responder and manually set the next responder.
You may need some logic to decide what is the next responder.
You may also need to ask the window to recalculate the next responder chain in it.
Sent from my iPhone
> On Sep 29, 2015, at 7:47 PM, Eyal Redler <email@hidden> wrote:
>
> I have a custom NSView subclass (let's call it "container"). The view contains many subviews and the subviews can have two states: expanded and collapsed.
> When one of the subviews is expanded, it reveals an editable text field, when the subview is collapsed, the field is removed.
> The container needs to also to be able to handle keystrokes (arrow keys) and for that purpose it access first responder implements keyDown.
> The reason I'm handling arrow keys in the container is that there is a concept of "selection" in that view and I want to allow the user to modify the selection using the arrow keys (similar to what you would do with a table view)
> My problem is as follows:
> If I click one of the container subviews - the container will become first responder and the keyboard is handled correctly.
> If, after that, I expand one of the subviews and start editing the text, the text field will grab keyboard handing (which is OK and expected) but, when I collapse that subview, and the editable text field is removed, keyboard focus doesn't come back to the container and no amount of clicking around the other subview of the container will restore that ability. It is as if having edited the text field "Destroyed" the ability of the container to get keyboard focus.
>
> Thanks in advance
>
>
>
> Eyal Redler
> ------------------------------------------------------------------------------------------------
> "If Uri Geller bends spoons with divine powers, then he's doing it the hard way."
> --James Randi
> www.eyalredler.com
>
>
> _______________________________________________
>
> 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
_______________________________________________
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