• 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: Loading a nib window and making it key
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Loading a nib window and making it key


  • Subject: Re: Loading a nib window and making it key
  • From: David Rehring <email@hidden>
  • Date: Mon, 24 Sep 2001 13:10:59 -0700

> David,
>
>>>>>>> David Rehring (DR) wrote at Mon, 24 Sep 2001 11:27:09 -0700:
> DR> >pingWindowController = [[PingWindowController alloc] init];
> DR> >if (pingWindowController) {
> DR> >[pingWindowController showWindow:sender];
> DR>
> DR> Try inserting [pingWindowController makeKeyAndOrderFront];
> DR> (well, with the correct parameter list)
>
> nil or self or whatever -- an object, which is ignored.
>
> I'm not sure though whether the window controller would forward the message
> to the window correctly. Perhaps it would; if not, you want probably
> "[[pingWindowController window] makeKeyAndOrderFront:self]".
>
> DR> >if (![[pingWindowController window] isKeyWindow]) NSLog(@"Not
> DR> >key window!");
> DR> >}
> DR> >
> DR> >The window appears but is not made the key window until
> DR> >I click in it, or select the corresponding name
> DR> >from the Window menu.
> DR>
> DR> If you did it before the 'showWindow', it's possible that the window
> DR> either hasn't actually be instantiated [you can load the .nib with the
> DR> window closed and it won't necessarily be instantiated] or that
>
> I don't think so.
>
> DR> makeKeyAndOrderFront is defined to do nothing if the window isn't
> DR> on-screen.
>
> I don't think so.
>
> I can't see where the real problem is (sorry -- that's why I haven't
> answered the original mail), but I am pretty sure it won't be this: all
> objects from a NIB _are_ instantiated one way or another, and
> makeKeyAndOrderFront: _would_ bring an offscreen window to the screen.

Whups, wasn't paying close enough attention. I didn't read
'windowController', I read 'window' instead.

I've found that loading a .nib does not instantiate everything. In
particular, if the window is marked as not being visible, I found I had to
first get the window, then call makekeyandorderfront. I believe even
outlets from the .nib weren't initialized yet.

But, this was around the 10.0 timeframe...and perhaps I was using the wrong
API to load the nib.

Later,
--
David Rehring Psychos do not explode when light hits
Senior Software Engineer them, no matter how crazy they are...
Atimi Software, Inc.
www.atimi.com And totally insane guy!


References: 
 >Re: Loading a nib window and making it key (From: Ondra Cada <email@hidden>)

  • Prev by Date: Re: multiline NSTextFields
  • Next by Date: Re: Best choice of graphics libs for gaming.
  • Previous by thread: Re: Loading a nib window and making it key
  • Next by thread: Re: Loading a nib window and making it key
  • Index(es):
    • Date
    • Thread