Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSPopover steals key window making underlying window flash selections. Any fix?

I have a 10.7 app that uses a small NSPopover to display some text. The user is never meant to interact with it.

When the NSPopover appears, the underlying view loses key status, and the selection changes colour, etc. Is there a way to get this not to happen?

like image 290
Tom Andersen Avatar asked Sep 12 '11 22:09

Tom Andersen


1 Answers

I do this:

    [[NSNotificationCenter defaultCenter] addObserverForName:NSPopoverDidShowNotification 
        object:myPopover queue:nil usingBlock:^(NSNotification *note) {
          [window becomeKeyWindow]; //Reclaim key from popover
          [window makeFirstResponder:previousFirstResponder];
    }];
like image 104
SG1 Avatar answered Nov 16 '22 03:11

SG1