• 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: NSTextField Tab Order.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextField Tab Order.


  • Subject: Re: NSTextField Tab Order.
  • From: Robert Tillyard <email@hidden>
  • Date: Wed, 13 Jun 2012 22:15:57 +0100

Hello, Ken,

Thank you for your reply.

On 13 Jun 2012, at 10:47, Ken Thomases wrote:

> On Jun 13, 2012, at 3:40 AM, Robert Tillyard wrote:
>
>> mind you despite window being hooked up in IB window == NULL
>
> You need to figure this out first.  It's indicative of a deeper problem.

I've checked again and it's still NULL.

> Are you referring to the window property of a custom subclass of NSWindowController?  Is this window controller being instantiated in code?  If so, what initializer is called?  How is that initializer implemented?  In particular, I'm looking to make sure that -initWithWindowNibName: was called, or, if -initWithWindowNibName:owner: was called instead that the window controller passed itself as the owner (making use of that method redundant).

Window is created from a XIB using:

- (id)initWithManagedObjectContext:(NSManagedObjectContext *)inMoc
{
   if ((self = [super initWithWindowNibName:@"RunnersWindow" owner:self]))
      [self setManagedObjectContext:inMoc];

   return (self);
}

- (void)windowDidLoad
{
   [window setAutorecalculatesKeyViewLoop:NO];
   NSLog (@"windowDidLoad: Window = %@\n", window);
}


> In the NIB, did you set the class of File's Owner to be your window controller class?  Was it File's Owner's window outlet that you hooked up?  A common mistake is to actually instantiate the window controller in the NIB and therefore have two window controllers.  That won't work right, obviously.

In the XIB Files Owner is set to my WindowController sub-class.

The Files Owner's window outlet says it's linked to window but I have in the past had problem in a different project where I had two awakeFromNibs called, I don't know how that happened but it seems that something I did in that project caused two instances of my window controller to be created.

How would I know if I've instantiated the window controller in my NIB? would I see two windowDidLoad messages?

> At what point did you attempt to use the window outlet?  If it was before -awakeFromNib or -windowDidLoad, it would be too early.  A common mistake is to attempt to reference the window during the initializer.
>

I use the window outlet in windowDidLoad and in the method called by the NSControlTextDidEndEditingNotification notifications.

>
>> I've tried hooking up the nextKeyView in IB but that doesn't help. I've also used [window setAutorecalculatesKeyViewLoop:NO]; in windowDidLoad (and in IB it's un-ticked) which doesn't help either
>
> Did you set the initialFirstResponder outlet of the window to point to the first key view in your loop?  According to the docs for -[NSWindow recalculateKeyViewLoop], it is called "when [the window] is first loaded, ... automatically if your window does not have a key view loop already established".  I suspect that means if initialFirstResponder is not set.  So, I suspect that failing to set that means that the method will blow away your configuration of nextKeyView connections.

Okay, here I can see I screwed that up. I had no initialFirstResponder, now I've set it the tab order works perfectly.

I'd still like to fix my window == NULL problem as I would like to make the enter key move to the next field and skip fields if some earlier information means that future fields are not required.

> Regards,
> Ken

Thanks, again for taking the time to help.

Regards, Rob.
_______________________________________________

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

  • Follow-Ups:
    • Re: NSTextField Tab Order.
      • From: Dennis <email@hidden>
    • Re: NSTextField Tab Order.
      • From: Ken Thomases <email@hidden>
    • Re: NSTextField Tab Order.
      • From: Quincey Morris <email@hidden>
References: 
 >NSTextField Tab Order. (From: Robert Tillyard <email@hidden>)
 >Re: NSTextField Tab Order. (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: Sandoxing: Creating a security-scoped bookmark for contents of a user-specified directory.
  • Next by Date: Re: TextField not updated in a sheet for document-based Cocoa app
  • Previous by thread: Re: NSTextField Tab Order.
  • Next by thread: Re: NSTextField Tab Order.
  • Index(es):
    • Date
    • Thread