Search code examples
macoscocoanssearchfield

I have a NSSearchField connected to an IBAction. How to set it to fire the action upon Enter press only?


I have a NSSearchField that searches a PDF in a PDFView. I would like it to trigger the connected IBAction only when the user presses enter. Regardless of the action setting in interface builder, it fires the action after any letter that I type. I would like to fire it only when the user presses Enter or focus is given to another responder. Thanks for any help.


Solution

  • Switch on 'Sends Whole Search String' and set Action to 'Send On End Editing'.