Why wont this window accept key input?
Why wont this window accept key input?
- Subject: Why wont this window accept key input?
- From: "Aychamo Aychamo" <email@hidden>
- Date: Thu, 19 Oct 2006 01:45:14 -0400
Hey guys
Here's what I'm trying to do. I want to launch Quicktime and have it
run full-screen mode (I accomplish this via AppleScript). Then, I
want to pop my window up and have it accept keyboard input, instead of
Quicktime accepting it.
However, with my code, I can launch the movie in Quicktime, and then
my app will show it's window on top of the Quicktime movie (as it
should), but my app won't accept keyboard input, it goes directly to
the Quicktime movie. But, if I use the mouse and click on my window,
it works at it should. So, I need to eliminate this need to click..
Is there anything you guys can see in the code below that seems wrong?
Or is there even a way to hardware hack the mouse to simulate a click
in a certain point?
I have the following code so far:
// theURL is passed...
NSString * hfsStylePathString = (NSString
*)CFURLCopyFileSystemPath((CFURLRef)theURL, kCFURLHFSPathStyle);
NSString *theScript = [NSString stringWithFormat:@"tell application
\"QuickTime Player\"\nset unixpath to alias \"%@\"\nactivate\nopen
unixpath\ntell movie 1\nset quit when done to true\npresent scale
screen\nend tell\nend tell", hfsStylePathString];
[self runAppleScript: theScript];
BezelWindow *theWindow = [[BezelWindow alloc] init];
NSRect theScreenRect = [[NSScreen mainScreen] frame];
BezelBox *theBox = [[BezelBox alloc] init];
[theWindow setContentView: theBox];
[theBox setFrameSize: NSMakeSize (300,300)];
[theBox setFrameOrigin: NSMakePoint (0,0)];
[theWindow makeKeyAndOrderFront: self];
[theWindow display];
[theWindow makeFirstResponder: theBox];
This is my subclassed (BezelWindow) window code:
[self setBackgroundColor:[NSColor clearColor]];
NSRect theScreenFrame = [[NSScreen mainScreen] frame];
[self setFrame:theScreenFrame display:YES animate:NO];
[self setHasShadow:NO];
[self setOpaque:NO];
[self setLevel:NSScreenSaverWindowLevel];
(and yes, this returns canBecomeKeyWindow: YES)
(BezelBox just draws a square in it's drawRect)
I used NSScreenSaverWindowLevel because it's at the top of the window
stack. I've tried other Window levels without luck.
Thank you for any ideas and suggestions,
AA
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden