Re: Tool tips in NSTableView
Re: Tool tips in NSTableView
- Subject: Re: Tool tips in NSTableView
- From: Chuck Pisula <email@hidden>
- Date: Wed, 23 May 2001 10:18:48 -0700
Disclaimer: I'm not 100% sure of my answer below, but I think I'm
right....
On Saturday, May 19, 2001, at 08:02 AM, Max Horn wrote:
>
I want to display tool tips for items in a NSTableView (and also in a
>
NSOutlineView, but I figure the solution might be similiar). That is,
>
every item will have a different tool tip...
>
>
Looking at the AppKit header files revealed that NSView has a method
>
>
- (NSToolTipTag)addToolTipRect:(NSRect)aRect owner:(id)anObject
>
userData:(void *)data;
aRect: is the 'hot area' for the tooltip you are adding. You can add
many, though I think you might experience problems if there is overlap.
owner: is the object that will get the
view:stringForToolTip:point:userData: message when the system determines
the user has hovered over the 'hot area' long enough.
userData: is context info that will be passed to the owner in the afore
mentioned method.
>
which looks helpful. However, as so often, the docs only say
>
"Description forthcoming" :/ and I have no clue how I actually would
>
use that method. Userdata seems fair enough, but what exactly does
>
aRect specify? I figure I have to subclass NSToolTipOwner, and handle:
>
>
- (NSString *)view:(NSView *)view stringForToolTip:(NSToolTipTag)tag
>
point:(NSPoint)point userData:(void *)data;
1. NSToolTipOwner is a protocol and not a class, so you should simply
implement this method in the class of the object you specified as owner,
when you added the tooltip. I like to think of this as a tooltip "data
source".
view: is the view the tooltip was originally installed upon.
tag: is the tag which should match the return value from
addToolTipRect:owner:userData:
point: is where the mouse is.
userData: already explained...
Hope this helps. Again, disclaimer.... I "think" this is acurate.
-chuck