• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: how to set up nextKeyView, full keyboard access etc, for custom subviews set up in code (rather than nib)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to set up nextKeyView, full keyboard access etc, for custom subviews set up in code (rather than nib)


  • Subject: Re: how to set up nextKeyView, full keyboard access etc, for custom subviews set up in code (rather than nib)
  • From: Ricky Sharp <email@hidden>
  • Date: Thu, 27 Nov 2008 05:57:40 -0600


On Nov 26, 2008, at 9:47 PM, Rua Haszard Morris wrote:

I have a dialog that has a few controls as well as a complex custom view that itself contains other controls as subviews. The custom view (for various good reasons) is instantiated and added as a subview in code. A template view and NSView's replaceSubview:with is used so the positioning etc can be set in the nib.

To fully support keyboard access, I need to somehow set things up so that the user can tab from the nib-instantiated controls to the controls within the custom view and then back out again. How can I achieve this?

I'll also (presumably) need to set up the nextKeyView-chain for the controls within the custom view (composed of a hierarchy of subviews with their own subcontrols...), but I think I have an idea of how to do this.


While I don't manually set up any UI as you're doing, I found that in some cases, I still needed to programatically rewire the key loop.

This was especially so for complex screens involving nested tabless tab views.


To manually rewire controls, look into the setNextKeyView: API.

If you then have tab views, you may need to provide an implementation of tabView:didSelectTabViewitem: and rewire controls based upon the new selected tab.

Also inside of tabView:didSelectTabViewItem:, I had to sometimes reset the window's firstResponder. But, make sure to first ask the view if it can be the first responder using canBecomeKeyView.

___________________________________________________________
Ricky A. Sharp         mailto:email@hidden
Instant Interactive(tm)   http://www.instantinteractive.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


References: 
 >how to set up nextKeyView, full keyboard access etc, for custom subviews set up in code (rather than nib) (From: Rua Haszard Morris <email@hidden>)

  • Prev by Date: Re: NSTrackingArea strange requirement
  • Next by Date: Re: NSTrackingArea strange requirement
  • Previous by thread: how to set up nextKeyView, full keyboard access etc, for custom subviews set up in code (rather than nib)
  • Next by thread: Private frameworks in a bundle
  • Index(es):
    • Date
    • Thread