Focus NSAlert accessory item
I have an NSAlert item that uses an NSTextField as an accessory item to provide an prompt-like dialog box. The only problem that I have is that when the alert is ran the text field is not focused. I tried looking for a 开发者_Go百科way to change NSAlert's first responder but found nothing. Is there a way to easy focus an accessory item in NSAlert?
It seems like you should be able to do something like:
[[alert window] setInitialFirstResponder: myAccessoryView];
before the alert is shown.
You can use [NSWindow makeFirstResponder:] but must make sure to call this after the alert is displayed.
精彩评论