• 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: Tooltips in NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tooltips in NSTableView


  • Subject: Re: Tooltips in NSTableView
  • From: Brian Webster <email@hidden>
  • Date: Tue, 29 Jan 2002 00:09:46 -0600

On Monday, January 28, 2002, at 10:39 PM, cocoa-dev-
email@hidden wrote:

Since the first got me a cell, I tried :

if ([[tableColumn identifier] isEqualToString:@"Name"]){
NSString* theToolTip = [NSString stringWithFormat:@"Name
column, row=%i", row];
[[cell controlView] setToolTip:theToolTip];

This doesn't seem to work

This is because the setToolTip: method sets a single tooltip for the entire NSTableView, so each time you call it you just replace what was there before.

What you should do is to call addToolTipRect:owner:userData: on the NSTableView in your awakeFromNib method (the docs for this method are in the NSView class). Then, whenever the mouse moves over the table view, the owner object you pass in will have its view:stringForToolTip:point:userData: method call. You can use the point along with NSTableView's columnAtPoint: and rowAtPoint: methods to determine the cell, and return the appropriate tooltip. Assuming your table view will shrink and grow in size, it's probably easiest just to add a single enormous rectangle to track so that it will always encompass the whole table view.

--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster


  • Prev by Date: Re: Menu About to show notification
  • Next by Date: Re: Springs and struts with splitview
  • Previous by thread: Re: Tooltips in NSTableView
  • Next by thread: initWithURL/NSattributedStrings and NSData
  • Index(es):
    • Date
    • Thread