This isn't the easiest thing to solve and you need to do a few things to get this to work.
1 ) add a MainMenu to your MainMenu.xib file.
Even though the main menu won't display (because you're only doing a NSStatusBar item), you want that main menu because of the command keys in the Edit menu (i.e. something to intercept the cmd-X, cmd-C & cmd-V's). Those command keys will be sent to your text field or your webview, whatever is the first responder.
More info can be seen here.
2 )
I made your textfield the first responder by adding:
- (void)viewDidAppear
{
[super viewDidAppear];
[self.textField becomeFirstResponder];
}
to your ViewController.m file.
3 )
You also need to make the window brought up by the Status Item a key window. In your example app, you did have a commented out canBecomeKeyWindow
method. I uncommented it out and always return TRUE
.
More info can be seen here.
Hope this helps!
canBecomeKeyWindow
and returningYES
. – Depilate