• 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
Keyboard Loop with sub-subviews
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Keyboard Loop with sub-subviews


  • Subject: Keyboard Loop with sub-subviews
  • From: Jerry Krinock <email@hidden>
  • Date: Thu, 5 Apr 2007 05:47:18 -0700

I've created a custom view which in turn contains an editable NSTextField. The whole thing can be programatically inserted into a window. Very cool and modular.

Now, I believe the keyboard loop for a window with such a view should theoretically be like a tree traversal: recursively enter subviews (branches), traverse their loops, then jump back up to the parent view when done.

By inserting the following over-rides into my custom view implementation, I've got it to work in the forward direction (tab key), but not in the reverse direction (shift-tab).

- (BOOL)acceptsFirstResponder {
	return YES ;
}

- (BOOL)resignFirstResponder {
	return YES ;
}

- (void)setNextKeyView:(NSView*)view {
	[[self editableField] setNextKeyView:view] ;
}

- (BOOL)becomeFirstResponder {
	BOOL x = [[self window] makeFirstResponder:[self editableField]] ;
	return x ;
}

I tried also over-riding -nextKeyView and -previousKeyView, to similarly forwarding to the editableField, but that did not help.

Jerry Krinock

P.S. Maybe it would help if I knew for sure how -previousKeyView works. -nextKeyView obviously just returns what you told it when you -setNextKeyView. But there is no -setPreviousKeyView! I suppose it might execute a function which asks -nextKeyView to each - nextKeyView, until it gets back to itself, then returns the previous view. But that doesn't seem to explain the problem I'm having.


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


  • Prev by Date: Re: Core Data Document-Based App
  • Next by Date: Re: Help for responders...
  • Previous by thread: Re: Core Data and Views
  • Next by thread: Cocoa wrapper for pcap library?
  • Index(es):
    • Date
    • Thread