Re: makeKeyAndOrderFront and NSBorderlessWindowMask
Re: makeKeyAndOrderFront and NSBorderlessWindowMask
- Subject: Re: makeKeyAndOrderFront and NSBorderlessWindowMask
- From: "trozo" <email@hidden>
- Date: Tue, 17 Feb 2004 12:09:48 +0100
Hmm... I forgot to mention that I'm not getting all of the MouseDown events
too. I get about 9 out of 10... more or less...
and when I press a key, all i get is a beep...
Thanks,
-Jorge
Mensaje citado por Jorge Arroyo <email@hidden>:
>
On Feb 17, 2004, at 1:29 AM, Brian Christensen wrote:
>
>
> On Feb 16, 2004, at 6:47 PM, Jorge Arroyo wrote:
>
>
>
>> I'm having a bit of trouble trying to get keyboard events into a
>
>> NSBorderlessWindowMask window. I've subclassed NSWindow to override
>
>> the
>
>> canBecomeKeyWindow method. I call makeKeyAndOrderFront at the end of
>
>> the applicationDidFinishLaunching function. All I get when I run the
>
>> app and press a key is a beep.
>
>
>
> Could you post your applicationDidFinishLaunching method? Perhaps
>
> there's something wrong in there.
>
>
>
> /brian
>
>
>
>
>
Here's the method:
>
>
- (void)applicationDidFinishLaunching:(NSNotification *)notification
>
{
>
int windowLevel;
>
NSRect screenRect;
>
NSString* aPath;
>
NSBundle* aBundle;
>
NSData *aData;
>
NSSize screensize;
>
>
// Capture the main display
>
if (CGDisplayCapture( kCGDirectMainDisplay ) != kCGErrorSuccess) {
>
NSLog( @"Couldn't capture the main display!" );
>
// Note: you'll probably want to display a proper error dialog
>
here
>
}
>
// Get the shielding window level
>
windowLevel = CGShieldingWindowLevel();
>
>
>
screenRect = [[NSScreen mainScreen] frame];
>
mainWindow = [[NSWindow alloc] initWithContentRect:screenRect
>
styleMask:NSBorderlessWindowMask
>
backing:NSBackingStoreBuffered
>
defer:NO screen:[NSScreen mainScreen]];
>
>
>
[mainWindow setLevel:windowLevel];
>
[mainWindow setBackgroundColor:[NSColor blackColor]];
>
// [mainWindow makeKeyAndOrderFront:nil];
>
>
// Load our content view
>
[viewPanel setFrame:screenRect display:YES];
>
[mainWindow setContentView:levelView]; //[viewPanel contentView]];
>
[mainWindow makeKeyAndOrderFront:nil];
>
[mainWindow makeKeyWindow];
>
if( [mainWindow isKeyWindow])
>
{NSLog(@"YES");}
>
else
>
{NSLog(@"NO"); }
>
>
// Here goes other code to initialize other objects
>
}
>
>
In the console, I can always see a NO printed so the window never
>
becomes key window. Also, I've tried the call to makeJeyAndOrderFront
>
with "self" instead of "nil" but get the same result. The call to
>
setContentView, is passing "levelView" which is a IBOutlet pointing to
>
a subclass of NSOpenGLView.
>
>
In my custom NSWindow class, the only code is this:
>
>
- (BOOL)canBecomeKeyWindow
>
{
>
return YES;
>
}
>
>
Thanks,
>
>
-Jorge
_______________________________________________
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.