Next Page > Hide TOC

Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

NSHelpManager

Inherits from
Package
com.apple.cocoa.application
Companion guide

Overview

NSHelpManager provides an approach to displaying online help. An application contains one instance of NSHelpManager. Your application’s code rarely needs to access NSHelpManager directly. Instead, you use Interface Builder and Xcode to set up online help for your application.

Tasks

Constructors

Creating an NSHelpManager Instance

Getting and Setting Context Help Mode

Returning Context-sensitive Help

Setting Up Context-sensitive Help

Displaying Application Help

Constructors

NSHelpManager

Creates an empty NSHelpManager.

public NSHelpManager()

Static Methods

isContextHelpModeActive

Returns true if the application is currently in context-sensitive help mode, false otherwise.

public static boolean isContextHelpModeActive()

Discussion

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

Controls context-sensitive help mode.

public static void setContextHelpModeActive(boolean flag)

Discussion

If flag is true, the application enters context-sensitive help mode. If flag is false, 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 a ContextHelpModeDidActivateNotification to the default notification center. When the application returns to normal operation, NSHelpManager posts a ContextHelpModeDidDeactivateNotification.

See Also

sharedHelpManager

Returns the shared NSHelpManager instance, creating it if it does not already exist.

public static NSHelpManager sharedHelpManager()

Instance Methods

contextHelpForObject

Returns context-sensitive help for object.

public NSAttributedString contextHelpForObject(Object object)

See Also

findString

Performs a search for the specified string in the specified book.

public void findString(String query, String book)

Discussion

The query parameter specifies the search string, and book should be a localized help book name or null. If book is null, all installed help books are searched.

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.

Availability

openHelpAnchor

Finds and displays the text at the given anchor location in the given book.

public void openHelpAnchor(String anchor, String book)

Discussion

The anchor parameter is a string specifying the anchor location, and book should be a localized help book name or null. If book is null, all installed help books are searched.

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.

Availability

removeContextHelpForObject

Removes the association between object and its context-sensitive help.

public void removeContextHelpForObject(Object object)

Discussion

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

setContextHelpForObject

Associates help with object.

public void setContextHelpForObject(NSAttributedString help, Object object)

Discussion

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

showContextHelpForObject

Displays the context-sensitive help for object at or near the point on the screen specified by point.

public boolean showContextHelpForObject(Object object, NSPoint point)

Discussion

This point is usually just under the cursor. Returns true if it successfully displays context-sensitive help for the object, false if it cannot (for example, if there is no context-sensitive help associated with this object).

See Also

Notifications

ContextHelpModeDidActivateNotification

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 NSHelpManager object. This notification does not contain a userInfo dictionary.

ContextHelpModeDidDeactivateNotification

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 NSHelpManager object. This notification does not contains a userInfo dictionary.



Next Page > Hide TOC


© 1997, 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-02-01)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.