• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSSearchField with menu and cancel button
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSSearchField with menu and cancel button


  • Subject: Re: NSSearchField with menu and cancel button
  • From: Steve Palmer <email@hidden>
  • Date: Fri, 13 Feb 2004 06:54:00 +0000

Wow, thanks. That did the trick! :-)

- Steve


On Feb 12, 2004, at 10:50 AM, Jeremy Dronfield wrote:

On 11 Feb 2004, at 6:47 pm, Steve Palmer wrote:

From IB, I can add a SearchField to a view but that gets me a plain NSSearchField with no menu or cancel button. From looking in the documentation, it seems that I need to support an NSSearchFieldCell object but IB does not provide a palette for this that I can see and the documentation is somewhat unclear. So the question is - how do I add a NSSearchFieldCell to a view from IB?

Don't worry about the cell. The menu can be added programmatically or (my preference) in IB. In IB, create a menu (by dragging a menu off the palette into your nib window). Connect your search field's searchMenuTemplate outlet to the menu. Then, to have your menu remember recent searches, add three items to the menu, with the following titles and tags:

"Recent Searches:", tag 1000
"Recents", tag 1001
"Clear Recent Searches", tag 1002

That's all. The API will handle the rest for you automagically. The API will also handle the cancel button (it appears as soon as some text is typed into the search field).

Hope this helps.

-Jeremy

========================================
email@hidden

theLocustFarm.net:
- fractious fiction at http://freespace.virgin.net/jeremy.dronfield
========================================
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >NSSearchField with menu and cancel button (From: Steve Palmer <email@hidden>)
 >Re: NSSearchField with menu and cancel button (From: Jeremy Dronfield <email@hidden>)

  • Prev by Date: Re: [Slightly OT] Shareware donation collection
  • Next by Date: Re: [Slightly OT] Shareware donation collection
  • Previous by thread: Re: NSSearchField with menu and cancel button
  • Next by thread: Simple example of threading
  • Index(es):
    • Date
    • Thread