Here is a wild wild guess, perhaps I want to have my NSWindow to somehow belong to the menubar application. So technically, it looks like a window, but actually is just NSView drawn out from the menubar with no NSWindow but accepts keyboard/mouse events? Is it possible to have NSView without NSWindow? Or is this all crazy talk from the caffeinated drinks?
-- john k. On Fri, Jun 12, 2009 at 3:15 PM, John Ku <john.c...@gmail.com> wrote: > I got to play around > with your suggestions but still cannot get it to not loose focus. Thought it > did give me a better perspective on how levels, frames, keys work. > Thank you for that. > I have the NSWindow and removed NSView for testing, but when I clicked on > the NSWindow, it'll still switch focus to it. I got the level working, > always floating ontop of windows, but just need a way for my app to not > become key or attract focus, but still able to receive keyboard/mouse > events. > > I have set FirstResponders, CanBecomeKey, at various settings but could not > get it right. If anyone can offer any leads, that would be appreciated. > > Thanks, > john > > On Fri, Jun 12, 2009 at 1:00 AM, Chunk 1978 <chunk1...@gmail.com> wrote: > >> if you don't want your apps window to become focused, you have to >> return NO on canBecomeKeyWindow, but if you want it to appear above >> the other windows, you should set it's level higher. here's some code >> you can use as a guide: >> >> -=-=-=-=- >> #import "DesktopWindow.h" >> >> @implementation DesktopWindow >> >> - (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned >> int)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag >> { >> [super initWithContentRect:contentRect >> styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered >> defer:NO]; >> [self setLevel: NSNormalWindowLevel +1]; >> >> // there are several window levels, check the documentation for the >> one that you require, and make sure that it's lower than the >> screensaver if you don't want it to be visible when the screensaver is >> active. >> >> [self setBackgroundColor:[NSColor colorWithDeviceWhite:1.0 >> alpha:1.0]]; >> [self setOpaque:YES]; >> NSRect screenFrame = [[NSScreen mainScreen] frame]; >> [self setFrame:screenFrame display:YES]; >> >> return self; >> } >> >> - (BOOL)canBecomeKeyWindow >> { >> return NO; >> } >> >> @end >> -=-=-=-=-=- >> >> On Fri, Jun 12, 2009 at 3:11 AM, John Ku<john.c...@gmail.com> wrote: >> > Thank you, I had that implemented. The problem still persist where my >> > subclass of NSWindow gets focused and deactivates the current running >> > program's window. >> > I want to have NSWindow to get keyboard/mouse events and still not >> > deactivate/lose focus of your current running application. >> > >> > Let's say I have Safari in focus, >> > currently running, and when user clicks on my menu bar application, pop >> up >> > menu appears and listens for keyboard/mouse events. But safari window >> still >> > remains active, or at least doesn't lose focus on the window. >> > >> > Thanks, >> > John >> > >> > On Thu, Jun 11, 2009 at 11:59 PM, Chunk 1978 <chunk1...@gmail.com> >> wrote: >> > >> >> NSBorderlessWindowMask (i think that's what it's called) is what >> >> you're looking for. Apple supplies a sample app here: >> >> >> http://developer.apple.com/samplecode/RoundTransparentWindow/index.html >> >> >> >> On Fri, Jun 12, 2009 at 1:51 AM, John Ku<john.c...@gmail.com> wrote: >> >> > What I am trying to achieve is like CoverSutra's: >> >> > screenshot1.png< >> >> >> http://sophiestication.s3.amazonaws.com/images/coversutra/screenshot1.png >> > >> >> > A menu bar pop up menu where there is key/responder event but yet >> doesn't >> >> > switch away from the current running application. >> >> > >> >> > I experiemented with various NSWindow settings, but it always >> deactivates >> >> > the current application and switches to my app. >> >> > >> >> > I am a starting coder so I haven't fully comprehended Apple's >> provided >> >> > documents. But my wild wild guess is drawing an NSView directly >> without >> >> > NSWindow. Would this work? Is this >> >> > possible? What other ways can this be done? >> >> > >> >> > >> >> > Thank you all, >> >> > John >> >> > _______________________________________________ >> >> > >> >> > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >> >> > >> >> > 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: >> >> > >> http://lists.apple.com/mailman/options/cocoa-dev/chunk1978%40gmail.com >> >> > >> >> > This email sent to chunk1...@gmail.com >> >> > >> >> _______________________________________________ >> >> >> >> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >> >> >> >> 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: >> >> http://lists.apple.com/mailman/options/cocoa-dev/john.cmyk%40gmail.com >> >> >> >> This email sent to john.c...@gmail.com >> >> >> > _______________________________________________ >> > >> > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >> > >> > 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: >> > http://lists.apple.com/mailman/options/cocoa-dev/chunk1978%40gmail.com >> > >> > This email sent to chunk1...@gmail.com >> > >> _______________________________________________ >> >> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >> >> 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: >> http://lists.apple.com/mailman/options/cocoa-dev/john.cmyk%40gmail.com >> >> This email sent to john.c...@gmail.com >> > > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com