• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Tool tips in NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tool tips in NSTableView


  • Subject: Re: Tool tips in NSTableView
  • From: Max Horn <email@hidden>
  • Date: Wed, 23 May 2001 19:29:49 +0200

At 10:18 Uhr -0700 23.05.2001, Chuck Pisula wrote:
Disclaimer: I'm not 100% sure of my answer below, but I think I'm right....

Hehe, I am glad I got any answer, so thanx in advance ;)


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.

That is what I figured; but I am not so sure in which coordinate system I should specify aRect? That of the NSOutline/TableView, that of the surroungind scroll view, or maybe even the window? Most sense (from a API users PoV) would be if it was relative to the NSTableView... I guess I should just write a small test app and try it out (hm... like extending the OutlineView demo. NOw that I think of it, that should be fairly easy ;)




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.

Ups, of course. I just didn't think when I wrote this, of course NSToolTipOwner is a protocol and I have to implement it ;)


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.

Well, this matches with what I figured, so i think I will just go ahead and implement a simple test app. Maybe I can even release it to help ppl with the same problem ;)



Max
--
-----------------------------------------------
Max Horn
C++/ObjC/Java Developer

email: <mailto:email@hidden>
phone: (+49) 6151-494890


  • Follow-Ups:
    • Re: Tool tips in NSTableView
      • From: Chuck Pisula <email@hidden>
  • Prev by Date: Re: NSTabView question
  • Next by Date: Re: Tool tips in NSTableView
  • Previous by thread: Re: Tool tips in NSTableView
  • Next by thread: Re: Tool tips in NSTableView
  • Index(es):
    • Date
    • Thread