1

I'm trying to show a tooltip on the mouse hover at a NSImageCell. I've tried setting the property on Interface Builder (both on the NSImageCell and the NSTableColumn that contains it) but it didn't work.

Any ideas?

mikywan
  • 1,495
  • 1
  • 19
  • 38

3 Answers3

1

In case of NSTableView you can use

(NSString *)tableView:(NSTableView *)tableView toolTipForCell:(NSCell *)cell rect:(NSRectPointer)rect tableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row mouseLocation:(NSPoint)mouseLocation;
Mureinik
  • 297,002
  • 52
  • 306
  • 350
1

Neither NSCell nor NSTableColumn will display tool tips, because neither is a subclass of NSView. You will have to set the tool tip on the table view itself.

You can use -[NSView addToolTipRect:owner:userData:] to set a tool tip for a particular area of a view. In combination with -[NSTableView frameOfCellAtColumn:row:], you ought to be able to set up a different one for each cell.

jscs
  • 63,694
  • 13
  • 151
  • 195
1

I solved this by overriding this method in the controller for my NSOutlineView:

- (NSString *)outlineView:(NSOutlineView *)outlineView toolTipForCell:(NSCell *)cell rect:(NSRectPointer)rect tableColumn:(NSTableColumn *)tableColumn item:(id)item mouseLocation:(NSPoint)mouseLocation;
Quinn Taylor
  • 44,553
  • 16
  • 113
  • 131
mikywan
  • 1,495
  • 1
  • 19
  • 38