I write an “Agent” Cocoa app where I have TextField in status icon’s menu, it looks like this:

(source: ifotos.pl)
And in couple of places I select its contents programmatically (e.g. in -(BOOL)becomeFirstResponder of my NSTextField subclass)
And it doesn’t work. It surely has something to do with the fact that it’s in menu, not in window. But how do I fix that?
Why don’t you just use a window instead? Menus are implemented as windows under the hood: you can do the same thing, just position and style your window appropriately.
Edit: answer largely rewritten