How can I programmatically display the NSSearchField menu?

I want to implement an NSSearchField showing search results similar to Safari, but I cannot figure out how to display the menu programmatically. Any pointers would be greatly appreciated.

Update: I tried to do this programmatically by calling @ -performClick: @ in the @NSButtonCell @ object, which represents the search button inside the search field's search box cell, but so far I have confirmed that the executeClick function is actually called, call the menu.

+3
source share
1 answer

Safari seems to be using some sort of custom or private API to display search results. This is probably a menu-like window. The problem that I found is that in a regular pop-up menu, the keyboard focus will be removed from the search field, which you don’t want to be able to continue to enter text into the search field while updating the menu. I could not find an easy way to do this, but I suspect that it should be a child window that looks like a menu.

Here's a blog that documented the addition of something similar to Camino: http://summerofcamino.com/

0
source

Source: https://habr.com/ru/post/1753540/


All Articles