Class

NSSearchField

A text field control that’s optimized for performing text-based searches.

Declaration

@interface NSSearchField : NSTextField

Overview

NSSearchField provides a customized text field for entering search data, a search button, a cancel button, and a pop-up icon menu for listing recent search strings and custom search categories.

An NSSearchField object wraps an NSSearchFieldCell object. Access to most search field attributes occurs through the cell, which provides a more comprehensive programmatic interface for manipulating the search field. You can use an NSSearchField object to manipulate some aspects of the search field.

For additional information about search fields and how to manipulate them, see the NSSearchFieldCell class.

Topics

Managing Search

delegate

The delegate for the search field, or nil if the search field doesn’t have a delegate.

NSSearchFieldDelegate

A protocol that a search field delegate can use to determine when a search started or ended.

Managing Menu Templates

searchMenuTemplate

The menu object used to dynamically construct the search field’s pop-up icon menu.

NSSearchFieldClearRecentsMenuItemTag

The menu item for clearing the current set of recent string searches in the menu.

NSSearchFieldNoRecentsMenuItemTag

The menu item that describes a lack of recent search strings.

NSSearchFieldRecentsMenuItemTag

The location of recent search strings in the “recents” menu group.

NSSearchFieldRecentsTitleMenuItemTag

The menu item that provides the title of the menu group for recent search strings.

Managing Search Modes

sendsSearchStringImmediately

A Boolean value indicating whether the cell calls its action method immediately when an appropriate action occurs.

sendsWholeSearchString

A Boolean value indicating whether the cell calls its search action method when the user clicks the search button or presses Return, or after each keystroke.

Managing Recent Searches

recentSearches

The list of recent search strings for the control.

maximumRecents

The maximum number of search strings that can appear in the search menu.

recentsAutosaveName

The name under which the search field automatically archives the list of recent search strings.

NSSearchFieldRecentsAutosaveName

The string that stores the name under which a search field automatically archives it’s list of recent search strings.

Configuring the Search Field

centersPlaceholder

A Boolean value that determines whether the search field’s components are centered within the control.

Getting Search Field Metrics

- rectForCancelButtonWhenCentered:

The rectangle for the cancel button within the bounds of the search field.

- rectForSearchButtonWhenCentered:

The rectangle for the search button within the bounds of the search field.

- rectForSearchTextWhenCentered:

The rectangle for the search text within the bounds of the field.

Relationships

Inherits From