- Inherits from:
- NSObject
- Conforms to:
- NSObject
- (NSObject)
Declared in:
- AppKit/NSHelpManager.h
NSHelpManager provides an approach to displaying on-line help. An application contains one instance of NSHelpManager. Your application's code rarely needs to access NSHelpManager directly. Instead, you use Interface Builder and Project Builder to set up on-line help for your application.
Context-sensitive help (also referred to as context help) gives the user a small amount of information when they help-click an interface item. For example, if the user help-clicks a menu item called "Copy," they should get context help that says something like "Copies the currently selected text to the pasteboard." This text appears in a small window near where the user help-clicked, and the window disappears when the user clicks anywhere else in the application.
Help-clicking is performed in any one of several ways, depending on the hardware used. Help-clicking is performed when the user holds down the Help key, the F1 key, or the Alternate and Control keys while pressing the mouse button.
To provide context-sensitive help for your application, follow these steps:
RTF
or RTFD
file
containing the text and any images you want to appear when the user
help-clicks that interface item. Try to keep the text as brief as
possible and the images as small as possible.The text you
write will appear in a small window just under the cursor when the
user help-clicks an interface item. If the user help-clicks near
the edge of the screen, text may appear off-screen. (This is especially
prevalent when the user help-clicks a menu item.) Use hard returns
in your text so the window will be as narrow as possible..lproj
directory
of your project, then add them to the project.When you build your application, /usr/bin/compileHelp
packages
your help files into a property list named Help.plist
.
NSHelpManager knows how to extract context help from a Help.plist
file.
Most applications provide some form of on-line help that is more comprehensive and detailed than context-sensitive help, such as conceptual or task help. NSHelpManager allows you to provide this sort of comprehensive help in any way you choose. Some help authors prefer to provide comprehensive help in HTML using a World-Wide Web browser; others use tools such as Digital Librarian or Concurrence.
When the user chooses the Help menu item, the NSApplication method showHelp: is invoked. This method simply asks NSWorkspace to open the help file you have specified for your application. That file should be the starting point of your help, and should allow users to access whatever information they might need.
To specify a help file for your application, do one of the following:
.rtf
(where appName is
the name of the application).It's possible for applications to have more than one command under the Help menu and to have each command open a different help file. To implement this, connect each of the Help menu commands to a different action method. The action methods should send openFile: to the shared NSWorkspace object to open the appropriate help file. For example:
[[NSWorkspace sharedWorkspace] openFile:@"AppKit.rtf"];
- Creating an NSHelpManager instance
- + sharedHelpManager
- Getting and setting context help mode
- + setContextHelpModeActive:
- + isContextHelpModeActive
- Returning context-sensitive help
- - contextHelpForObject:
- - showContextHelpForObject:locationHint:
- Setting up context-sensitive help
- - setContextHelp:forObject:
- - removeContextHelpForObject:
+ (BOOL)isContextHelpModeActive
See Also: + setContextHelpModeActive:
+ (void)setContextHelpModeActive:(BOOL)flag
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, NSHelpManager posts a NSContextHelpModeDidActivateNotification to the default notification center. When the application returns to normal operation, NSHelpManager posts a NSContextHelpModeDidDeactivateNotification.
See Also: + isContextHelpModeActive
+ (NSHelpManager *)sharedHelpManager
- (NSAttributedString *)contextHelpForObject:(id)object
See Also: - setContextHelp:forObject:, - showContextHelpForObject:locationHint:
- (void)removeContextHelpForObject:(id)object
See Also: - setContextHelp:forObject:
- (void)setContextHelp:(NSAttributedString
*)help
forObject:(id)object
See Also: - removeContextHelpForObject:
- (BOOL)showContextHelpForObject:(id)object
locationHint:(NSPoint)point
See Also: - contextHelpForObject:
This notification contains a notification object but no userInfo dictionary. The notification object is the NSHelpManager object.
This notification contains a notification object but no userInfo dictionary. The notification object is the NSHelpManager object.