Inherits from | |
Conforms to | |
Framework | /System/Library/Frameworks/AppKit.framework |
Availability | Available in Mac OS X v10.0 and later. |
Companion guide | |
Declared in | NSHelpManager.h |
The NSHelpManager
class provides an approach to displaying online help. An application contains one NSHelpManager
object.
+ isContextHelpModeActive
+ setContextHelpModeActive:
– setContextHelp:forObject:
– removeContextHelpForObject:
Indicates whether context-sensitive help mode is active.
+ (BOOL)isContextHelpModeActive
YES
when the application is in context-sensitive help mode, NO
otherwise.
In context-sensitive help mode, when a user clicks a user interface item, help for that item is displayed in a small window just below the cursor.
NSHelpManager.h
Specifies whether context-sensitive help mode is active.
+ (void)setContextHelpModeActive:(BOOL)contextHelpActive
YES
turns on context-sensitive help, NO
turns it off.
You never send this message directly; instead, the NSApplication
method activateContextHelpMode:
activates context-sensitive help mode, and the first mouse click after displaying the context-sensitive help window deactivates it.
When the application enters context-sensitive help mode, the help manager posts an NSContextHelpModeDidActivateNotification
to the default notification center. When the application returns to normal operation, the help manager posts an NSContextHelpModeDidDeactivateNotification
.
NSHelpManager.h
Returns the shared NSHelpManager
instance, creating it if it does not already exist.
+ (NSHelpManager *)sharedHelpManager
Shared help manager.
NSHelpManager.h
Returns context-sensitive help for an object.
- (NSAttributedString *)contextHelpForObject:(id)object
Object for which context-sensitive help is sought.
Context-sensitive help content.
NSHelpManager.h
Performs a search for the specified string in the specified book.
- (void)findString:(NSString *)query inBook:(NSString *)book
String to search for.
Localized help book to search. When nil
, all installed help books are searched.
To search for a string in your bundle’s localized help book, you could use code similar to the following:
NSString *locBookName = [[NSBundle mainBundle] objectForInfoDictionaryKey: @"CFBundleHelpBookName"]; |
[[NSHelpManager sharedHelpManager] findString:@"Hello" inBook:locBookName]; |
This is a wrapper for AHRegisterHelpBook
(which is called only once to register the help book specified in the application's main bundle) and AHSearch
.
NSHelpManager.h
Finds and displays the text at the given anchor location in the given book.
- (void)openHelpAnchor:(NSString *)anchor inBook:(NSString *)book
Location of the desired text.
Help book containing the anchor. When nil
, all installed help books are searched.
To open an anchor in your bundle’s localized help book, you could use code similar to the following:
NSString *locBookName = [[NSBundle mainBundle] objectForInfoDictionaryKey: @"CFBundleHelpBookName"]; |
[[NSHelpManager sharedHelpManager] openHelpAnchor:@"anchor1" inBook:locBookName]; |
This method is a wrapper for AHRegisterHelpBook
(which is called only once to register the help book specified in the application's main bundle) and AHLookupAnchor
.
NSHelpManager.h
Removes the association between an object and its context-sensitive help.
- (void)removeContextHelpForObject:(id)object
Object to disassociate from its help content.
If object does not have context-sensitive help associated with it, this method does nothing.
NSHelpManager.h
Associates help content with an object.
- (void)setContextHelp:(NSAttributedString *)help forObject:(id)object
Help content to associate with object.
Object to associate with help.
When the application enters context-sensitive help mode, if object is clicked, help appears in the context-sensitive help window.
NSHelpManager.h
Displays the context-sensitive help for a given object at or near the point on the screen specified by a given point.
- (BOOL)showContextHelpForObject:(id)object locationHint:(NSPoint)point
Object for which context-sensitive help is sought.
Screen location at which to display the help content; it’s usually under the cursor.
YES
when help content is successfully displayed. NO
if help content is not displayed (for example, when there is no context-sensitive help associated with object).
NSHelpManager.h
Posted when the application enters context-sensitive help mode. This typically happens when the user holds down the Help key.
The notification object is the help manager. This notification does not contain a userInfo dictionary.
NSHelpManager.h
Posted when the application exits context-sensitive help mode. This happens when the user clicks the mouse button while the cursor is anywhere on the screen after displaying a context-sensitive help topic.
The notification object is the help manager. This notification does not contain a userInfo dictionary.
NSHelpManager.h
© 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-02-04)