Why wont this window accept key input?

  • 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,
previous month october 2006 next month
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today