Re: NSView directly drawn on screen?
Re: NSView directly drawn on screen?
- Subject: Re: NSView directly drawn on screen?
- From: Peter N Lewis <email@hidden>
- Date: Mon, 15 Jun 2009 10:31:12 +0800
On 13/06/2009, at 16:51 , Michael Ash wrote:
You can't. If you want to receive keyboard events then you must have
focus. If you don't want to have focus, then you can't receive
keyboard events. Pick one or the other, because you can't have both.
Well, technically you could use an event tap or some similar
mechanism. Almost never the right choice, but only almost never.
On 14/06/2009, at 6:29 , Uli Kusterer wrote:
Not true. Spotlight removes keyboard focus from the front app. Try
it in Mail: Put the cursor in the "Subject" text field so it gets
the blue focus border. Pull down the Spotlight menu. The focus
border goes away and Spotlight's search field gets the insertion mark.
Except, try the same thing in the Finder. Put the cursor in the
"Spotlight" search field so it gets the blue focus border. Pull down
the Spotlight menu. The focus border on the original Spotlight search
field remains. You even get two flashing insertion cursors. That's
very weird.
As Andy suggests, I suspect what you need is a floating panel window,
with canBecomeKeyWindow returning YES and canBecomeMainWindow
returning NO, a window level set to something appropriate (possibly
NSFloatingWindowLevel or NSStatusWindowLevel). You may also want
to look at:
[self setBecomesKeyOnlyIfNeeded:NO];
[self setFloatingPanel:YES];
[self setWorksWhenModal:YES];
and
- (void)makeKeyAndOrderFront:(id)sender
{
[NSApp activateIgnoringOtherApps:YES];
[super makeKeyAndOrderFront:sender];
[NSApp activateIgnoringOtherApps:NO];
}
And heaven help you if you are running a Carbon run loop and have a
borderless window.
Enjoy,
Peter.
--
Clipboard Switching and Macros with Keyboard Maestro
Keyboard Maestro <http://www.keyboardmaestro.com/> Macros for your Mac
<http://www.stairways.com/> <http://download.stairways.com/>
_______________________________________________
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