![]() |
API
0.9.6
|
#import <CPSearchField.h>
Additional Inherited Members | |
![]() | |
Class | isa |
The CPSearchField class defines the programmatic interface for text fields that are optimized for text-based searches. A CPSearchField object directly inherits from the CPTextField class. The search field implemented by these classes presents a standard user interface for searches, including a search button, a cancel button, and a pop-up icon menu for listing recent search strings and custom search categories.
When the user types and then pauses, the text field's action message is sent to its target. You can query the text field's string value for the current text to search for. Do not rely on the sender of the action to be an CPMenu object because the menu may change. If you need to change the menu, modify the search menu template and call the setSearchMenuTemplate: method to update.
Definition at line 2 of file CPSearchField.h.
|
implementation |
Returns the button object used to display the cancel-button image.
Definition at line 203 of file CPSearchField.j.
|
implementation |
Modifies the bounding rectangle for the cancel button.
rect | The updated bounding rectangle to use for the cancel button. The default value is the value passed into the rect parameter. Subclasses can override this method to return a new bounding rectangle for the cancel button. You might use this method to provide a custom layout for the search field control. |
Definition at line 267 of file CPSearchField.j.
|
implementation |
Definition at line 694 of file CPSearchField.j.
|
implementation |
Reimplemented from CPTextField.
Definition at line 406 of file CPSearchField.j.
|
implementation |
Provides the common case items for a recent searches menu. If there are not recent searches, displays a single disabled item:
No Recent Searches
If there are 1 more recent searches, it displays:
Recent Searches recent search 1 recent search 2 etc. --------------------- Clear Recent Searches
If you wish to add items before or after the template, you can. If you put items before, a separator will automatically be placed before the default template item. If you add items after the default template, it is your responsibility to add a separator.
To add a custom item:
item = [[CPMenuItem alloc] initWithTitle:"google" action:(google:) keyEquivalent:""]; [item setTag:700]; [item setTarget:self]; [template addItem:item];
Be sure that your custom items do not use tags in the range 1000-1003 inclusive. If you wish to maintain state in custom menu items that you add, you will need to maintain the item state yourself, then in the action method of the custom items, modify the items in the search menu template and send [searchField setSearchMenuTemplate:template] to update the menu.
Definition at line 550 of file CPSearchField.j.
|
implementation |
Reimplemented from CPTextField.
Definition at line 66 of file CPSearchField.j.
|
implementation |
Encodes the data of this textfield into the provided coder.
aCoder | the coder into which the data will be written |
Reimplemented from CPTextField.
Provided by category CPSearchField(CPCoding).
Definition at line 768 of file CPSearchField.j.
|
implementation |
Definition at line 480 of file CPSearchField.j.
|
implementation |
Reimplemented from CPControl.
Definition at line 71 of file CPSearchField.j.
|
implementation |
Initializes the textfield with data from a coder.
aCoder | the coder from which to read the textfield data |
Reimplemented from CPTextField.
Provided by category CPSearchField(CPCoding).
Definition at line 791 of file CPSearchField.j.
|
implementation |
Initializes the receiver for usage with the specified bounding rectangle
Reimplemented from CPTextField.
Definition at line 83 of file CPSearchField.j.
|
implementation |
Returns whether the receiver is completely opaque. By default, returns NO
.
Reimplemented from CPView.
Definition at line 422 of file CPSearchField.j.
|
implementation |
Returns the maximum number of recent search strings to display in the custom search menu.
Definition at line 338 of file CPSearchField.j.
|
implementation |
Reimplemented from CPResponder.
Definition at line 417 of file CPSearchField.j.
|
implementation |
Definition at line 667 of file CPSearchField.j.
|
implementation |
Definition at line 662 of file CPSearchField.j.
|
implementation |
Notifies the receiver that the user has clicked the mouse down in its area.
anEvent | contains information about the click |
Reimplemented from CPTextField.
Definition at line 494 of file CPSearchField.j.
|
implementation |
Returns the key under which the prior list of recent search strings has been archived.
Definition at line 384 of file CPSearchField.j.
|
implementation |
Returns the list of recent search strings for the control.
CPString
objects, each of which contains a search string either displayed in the search menu or from a recent autosave archive. If there have been no recent searches and no prior searches saved under an autosave name, this array may be empty. Definition at line 361 of file CPSearchField.j.
|
implementation |
Resets the cancel button to its default attributes. This method resets the target, action, regular image, and pressed image. This method gives you a way to customize the cancel button for specific situations and then reset the button defaults without having to undo changes individually.
Definition at line 212 of file CPSearchField.j.
|
implementation |
Resets the search button to its default attributes. This method resets the target, action, regular image, and pressed image. By default, when users click the search button or press the Return key, the action defined for the receiver is sent to its designated target. This method gives you a way to customize the search button for specific situations and then reset the button defaults without having to undo changes individually.
Definition at line 168 of file CPSearchField.j.
|
implementation |
Notifies the receiver that it has been asked to give up first responder status.
YES
if the receiver is willing to give up first responder status. Reimplemented from CPTextField.
Definition at line 489 of file CPSearchField.j.
|
implementation |
Returns the button used to display the search-button image.
Definition at line 159 of file CPSearchField.j.
|
implementation |
Modifies the bounding rectangle for the search button.
rect | The current bounding rectangle for the search button. Subclasses can override this method to return a new bounding rectangle for the search button. You might use this method to provide a custom layout for the search field control. |
Definition at line 257 of file CPSearchField.j.
|
implementation |
Returns the menu template object used to dynamically construct the search pop-up icon menu.
Definition at line 277 of file CPSearchField.j.
|
implementation |
Modifies the bounding rectangle for the search-text field.
rect | The current bounding rectangle for the search text field. |
Definition at line 231 of file CPSearchField.j.
|
implementation |
Causes anAction
to be sent to anObject
.
anAction | the action to send |
anObject | the object to which the action will be sent |
Reimplemented from CPControl.
Definition at line 459 of file CPSearchField.j.
|
implementation |
Returns a Boolean value indicating whether the receiver sends its action immediately upon being notified of changes to the search field text or after a brief pause.
YES
if the text field sends its action immediately upon notification of any changes to the search field; otherwise, NO. Definition at line 319 of file CPSearchField.j.
|
implementation |
Returns a Boolean value indicating whether the receiver sends the search action message when the user clicks the search button (or presses return) or after each keystroke.
YES
if the action message is sent all at once when the user clicks the search button or presses return; otherwise, NO if the search string is sent after each keystroke. The default value is NO. Definition at line 301 of file CPSearchField.j.
|
implementation |
Sets the button object used to display the cancel-button image.
button | The cancel button. |
Definition at line 183 of file CPSearchField.j.
|
implementation |
Sets the maximum number of search strings that can appear in the search menu.
maxRecents | The maximum number of search strings that can appear in the menu. This value can be between 0 and 254. Specifying a value less than 0 sets the value to the default, which is 10. Specifying a value greater than 254 sets the maximum to 254. |
Definition at line 347 of file CPSearchField.j.
|
implementation |
Sets the autosave name under which the receiver automatically archives the list of recent search strings.
name | The autosave name, which is used as a key in the standard user defaults to save the recent searches. If you specify nil or an empty string for this parameter, no autosave name is set and searches are not autosaved. |
Definition at line 393 of file CPSearchField.j.
|
implementation |
Sets the list of recent search strings to list in the pop-up icon menu of the receiver.
searches | An array of CPString objects containing the search strings. You might use this method to set the recent list of searches from an archived copy. |
Definition at line 371 of file CPSearchField.j.
|
implementation |
Sets the button used to display the search-button image
button | The search button. |
Definition at line 142 of file CPSearchField.j.
|
implementation |
Sets the menu template object used to dynamically construct the receiver's pop-up icon menu.
menu | The menu template to use. The receiver looks for the tag constants described in ŇMenu tagsÓ to determine how to populate the menu with items related to recent searches. See ŇConfiguring a Search MenuÓ for a sample of how you might set up the search menu template. |
Definition at line 287 of file CPSearchField.j.
|
implementation |
Sets whether the text field sends its action message to the target immediately upon notification of any changes to the search field text or after a brief pause.
flag | YES to send the text field's action immediately upon notification of any changes to the search field; otherwise, NO if you want the text field to pause briefly before sending its action message. Pausing gives the user the opportunity to type more text into the search field before initiating the search. |
Definition at line 328 of file CPSearchField.j.
|
implementation |
Sets whether the receiver sends the search action message when the user clicks the search button (or presses return) or after each keystroke.
flag | YES to send the action message all at once when the user clicks the search button or presses return; otherwise, NO to send the search string after each keystroke. |
Definition at line 310 of file CPSearchField.j.
|
implementation |
Called when the receiver is about to be moved to a new view.
aView | the view to which the receiver will be moved |
Reimplemented from CPView.
Definition at line 125 of file CPSearchField.j.