First responder not coming back to container after editing with NSTextField
First responder not coming back to container after editing with NSTextField
- Subject: First responder not coming back to container after editing with NSTextField
- From: Eyal Redler <email@hidden>
- Date: Tue, 29 Sep 2015 13:47:12 +0300
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