Re: window focus trouble
Re: window focus trouble
- Subject: Re: window focus trouble
- From: email@hidden
- Date: Mon, 4 Mar 2002 14:21:40 -0500
From: Howard J. Fink
>
Date: Mon, 04 Mar 2002 12:30:58 +0100
>
From: Gregor Nobis <email@hidden>
>
To: Cocoa-Dev List <email@hidden>
>
Subject: window focus trouble
>
>
I'm having trouble with window focus.
>
>
From a command-line Scheme interpreter (Scheme 48) I call Scheme code
>
that in turn calls some ObjectiveC code which is supposed to create and
>
display a window and order it in front of the terminal window. The ObjC
>
code consists of a subclassed NSApplication and a delegate to go with
>
it. Instead of calling [NSApp run] I use an ObjC function that runs a
>
while loop that imitates the run loop. (It simply gets events from the
>
event queue and sends them to the application using -sendEvent unless
>
they're nil) In the delegate's -applicationWillFinishLaunching method a
>
simple window (containing only an NSTextField) is created and sent
>
-makeKeyAndOrderFront.
The problem is that you are calling makeKeyAndOrderFront too soon! Both
applicationWillFinishLaunching and even applicationDidFinishLaunching are
called BEFORE the regular event loop starts running, so requests like
makeKeyAndOrderFront can't be handled yet. One way around this is to call a
method with a delay of zero that does the makeKeyAndOrderFront. As soon as
event processing gets started your "delayed" code will run, and this will
bring your window to the front.
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.