Re: NSSearchField with menu and cancel button
Re: NSSearchField with menu and cancel button
- Subject: Re: NSSearchField with menu and cancel button
- From: Jeremy Dronfield <email@hidden>
- Date: Thu, 12 Feb 2004 10:50:51 +0000
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.