Applications can provide users direct interaction with Spotlight by displaying the standard Spotlight search interface, shown in Figure 1.
The Carbon HISearchWindowShow
function provides a simple interface to the Spotlight search window. The following code fragment demonstrates extracting a string value from an NSSearchField
and displaying the search interface.
OSStatus resultCode=noErr; |
resultCode=HISearchWindowShow((CFStringRef)[sender stringValue],kNilOptions); |
if (resultCode != noErr) { |
// failed to open the panel |
// present an error to the user |
} |
The search window is presented using the default display settings that the user has configured in System Preferences.
© 2004, 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-03-08)