Force app to be key

  • Hey guys

    I posted this question earlier, but upon reviewing it, the question is
    really convoluted and ridiculous to expect an answer to.

    I'm looking for a method to force my app's window to be on top of all
    other windows, and to be key.  I've managed to make it's window be on
    top by using [myWindow setLevel: ] and setting it to the highest
    level.

    However, I can't seem to make it key.  I've tried setting [myWindow
    makeFirstResponder: myView], but it won't actually switch the control
    of the OS to my program.  If my progam is "active" it will work as
    needed, but I need to make OS X automatically select my window, even
    if another app is open.

    Thank you
    AA
  • > I'm looking for a method to force my app's window to be on top of all
    > other windows, and to be key.  I've managed to make it's window be on
    > top by using [myWindow setLevel: ] and setting it to the highest
    > level.

    Try this:

        [NSApp activateIgnoringOtherApps:YES];
        [myWindow makeKeyAndOrderFront:self];

    Stephen Deken
    <stephen.deken...>
  • Stephen,

    That worked.  I never in a million years would have even thought to
    look there.  I still have a lot to learn.  Thank you very, very much.

    AA

    On 10/19/06, Stephen Deken <stephen.deken...> wrote:
    >> I'm looking for a method to force my app's window to be on top of all
    >> other windows, and to be key.  I've managed to make it's window be on
    >> top by using [myWindow setLevel: ] and setting it to the highest
    >> level.
    >
    > Try this:
    >
    > [NSApp activateIgnoringOtherApps:YES];
    > [myWindow makeKeyAndOrderFront:self];
    >
    > Stephen Deken
    > <stephen.deken...>
    >
previous month october 2006 next month
MTWTFSS
            1
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