Re: Window behaviour question
Re: Window behaviour question
- Subject: Re: Window behaviour question
- From: Daniel Jalkut <email@hidden>
- Date: Mon, 19 May 2003 07:57:58 -0700
Hello Jesus - you probably have to make your app "active" (even though
it doesn't show up in the dock, it needs to be active to have its
window show up as the key window).
I do something like this in my faceless background app (FastScripts).
Since it's kind of rude to take control of the computer just to put up
a window, I like to keep track of who I took control away from, and
then set it back. Here are some methods I call in my app controller
just before displaying and after dismissing a dialog (panel).
If you use these methods, you will need to add Carbon.framework to your
project to appease the compiler for the Get/SetFrontProcess calls.
Hope this helps,
Daniel
- (void) activateGracefully
{
// First, do we even need to activate?
if ([NSApp isActive] == NO)
{
GetFrontProcess(&_activeApp);
_interruptedOtherApp = YES;
// Make ourselves frontmost!
[NSApp activateIgnoringOtherApps:YES];
}
}
- (void) deactivateGracefully
{
// Always deactivate ourself if we are active
if ([NSApp isActive] == YES)
{
[NSApp deactivate];
}
// If we interrupted somebody when we last activated, then
// kindly reactivate them
if (_interruptedOtherApp == YES)
{
SetFrontProcess(&_activeApp);
_interruptedOtherApp = NO;
}
}
On Monday, May 19, 2003, at 03:31 AM, Jesus De Meyer wrote:
>
In my app there's a menubar as a NSStatusBar. Now, when a user selects
>
an item a window pops up with a textfield in it. The problem I'm
>
having is that I want to give focus to the window, even when my app is
>
not the front app, so that the user can immediatly start typing into
>
the text field. And this without having to select the window, select
>
the text field and start typing.
>
>
Also it may be interesting to know my app is not visible in the Dock.
>
>
Any suggestions?
>
_______________________________________________
>
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.
_______________________________________________
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.