Inherits From:
NSObject
Conforms To:
NSObject (NSObject)
Declared In:
AppKit/NSHelpManager.h
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.
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.
/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.
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:
On Mach, it must be an RTF file called appName.rtf
(where appName is the name of the application).
On Microsoft Windows, it must be a Windows help file called appName.hlp
.
openFile:
to the shared
NSWorkspace object to open the appropriate help file. For example:
[[NSWorkspace sharedWorkspace] openFile:@"AppKit.hlp"];
isContextHelpModeActive
Returns YES if the application is currently 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.
See also:
+ setContextHelpModeActive:
setContextHelpModeActive:
(BOOL)flag
Controls context-sensitive help mode. If flag is YES, the application enters context-sensitive help mode. If flag is NO, the application returns to normal operation.
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
sharedHelpManager
Returns the shared NSHelpManager instance, creating it if it does not already exist.
contextHelpForObject:
(id)object
Returns context-sensitive help for object.
See also:
- setContextHelp:forObject:
, - showContextHelpForObject:locationHint:
removeContextHelpForObject:
(id)object
Removes the association between object and its context-sensitive help. If object does not have context-sensitive help associated with it, this method does nothing. Typically, you use Interface Builder to remove context-sensitive help from an item.
See also:
- setContextHelp:forObject:
setContextHelp:
(NSAttributedString *)help forObject:
(id)object
Associates help with object. When the application enters context-sensitive help mode, if object is clicked, help will appear in the context-sensitive help window. Typically, you use Interface Builder to associate context-sensitive help with an object.
See also:
- removeContextHelpForObject:
showContextHelpForObject:
(id)object locationHint:
(NSPoint)point
Displays the context-sensitive help for object at or near the point on the screen specified by point. This point is usually just under the cursor. Returns YES if it successfully displays context-sensitive help for the object, NO if it cannot (for example, if there is no context-sensitive help associated with this object).
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.