Inherits from: NSObject
Conforms to: NSObject
(NSObject)
Declared in: AppKit/NSHelpManager.h
The Rhapsody Help system is currently under development, so the API of NSHelpManager may change significantly in future releases.
NSHelpManager provides a platform-independent 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.
OpenStep applications can run on multiple platforms, and each platform provides its own support for on-line help. It's important to users that applications use the native on-line help system (on Microsoft Windows, for instance, users want the Microsoft Windows help system and don't want to have to learn how to use a different help system), so NSHelpManager does not provide a comprehensive solution for presenting help. Instead, it provides cross-platform support for context-sensitive help and allows you to present more comprehensive help (conceptual and task-based help) in any way you choose.
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 platform and the hardware used. On Mach platforms, 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. On Microsoft Windows platforms, users press Shift-F1 and then press the mouse button to display context-sensitive help. Some Microsoft Windows applications also have a What's This menu item on the Help menu. When the user selects this item, the next mouse click displays context-sensitive help.
To provide context-sensitive help for your application, follow these steps:
.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; on Microsoft Windows a full-featured native help system is available.
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).On Microsoft Windows,
it must be a Windows help file called appName.hlp
.It's common for Windows 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.hlp"];
- 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 NSContextHelpModeDidActivateNotification to the default notification center. When the application returns to normal operation, NSHelpManager posts 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:
Posted when the application enters context-sensitive help mode. This typically happens when the user holds down the Help key. It can also occur on Microsoft Windows platforms if the user chooses the What's This command from the Help menu.
This notification contains a notification object but no userInfo dictionary. The notification object is the NSHelpManager object.
Posted when the application exits context-sensitive help mode. This happens when the user clicks the mouse anywhere on the screen after displaying a context-sensitive help topic.
This notification contains a notification object but no userInfo dictionary. The notification object is the NSHelpManager object.