Instance Method

addToolTipRect:owner:userData:

Creates a tooltip for a defined area the view and returns a tag that identifies the tooltip rectangle.

Declaration

- (NSToolTipTag)addToolTipRect:(NSRect)rect owner:(id)owner userData:(void *)data;

Parameters

aRect

A rectangle defining the region of the view to associate the tooltip with.

anObject

An object from which to obtain the tooltip string. The object should either implement view:stringForToolTip:point:userData:, or return a suitable string from its description method. (It can therefore simply be an NSString object.)

userData

Any additional information you want to pass to view:stringForToolTip:point:userData:; it is not used if anObject does not implement this method.

Return Value

An integer tag identifying the tooltip; you can use this tag to remove the tooltip.

Discussion

The tooltip string is obtained dynamically from anObject by invoking either the NSToolTipOwner informal protocol method view:stringForToolTip:point:userData:, if implemented, or the NSObject protocol method description.

See Also

Tooltips

- removeAllToolTips

Removes all tooltips assigned to the view.

- removeToolTip:

Removes the tooltip identified by specified tag.

toolTip

The text for the view’s tooltip.