• 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: window focus trouble
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: window focus trouble


  • Subject: Re: window focus trouble
  • From: email@hidden
  • Date: Tue, 5 Mar 2002 11:12:56 -0500

From: Howard J. Fink






Gregor Nobis <email@hidden> on 03/05/2002 09:44:50 AM

To: email@hidden
cc: email@hidden, email@hidden
Subject: Re: window focus trouble


> > That may be a problem, but I have experienced the exact same problem
> > without any funny event loop stuff. The difference may be that it is
> > related to my app being kicked off by another app instead of launched
> > by a
> > click in the Finder, which would bring an app keyAndFront
automatically.
> > This is when I discovered that a call to makeKeyAndOrderFront (or
> > becomeKeyWindow or becomeMainWindow) in applicationDidFinishLaunching,
> > followed by calls to isKeyWindow and isMainWindow always returned NO.
>
> This is really the exact same thing with my app. And just like yours it
> does not get started from the Finder but from within that Scheme
> process. Where and how do you think I should call that delayed method
> you mentioned? I'm not sure I know what you are talking about. I really
> appreciate your help - I've been stuck with this stuff for quite a while
> now : (
>
> Gregor


Sure, here is how I did it, in my AppDelegate, in
applicationDidFinishLaunching:

[self performSelector:@selector(weAreRunning) withObject:nil
afterDelay:0.0];

and then:

// this gets called as soon as event processing is happening
- (void)weAreRunning
{
// do stuff in your window that by this time is main and key
}


I haven't tried it, but I also heard privately from Lance Bland, who
suggested another way:

> I like to subclass NSApplication and do:
>
> -(void)finishLaunch
> {
> [super finishLaunch];
>
> // now do stuff.
>
> }


Howard Fink
Eastman Kodak Company
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: "Where to go from here?" 2
  • Next by Date: Preference Panes
  • Previous by thread: Re: window focus trouble
  • Next by thread: Re: Cocoa:Re: number formatting
  • Index(es):
    • Date
    • Thread