Re: NSBrowser tooltips
Re: NSBrowser tooltips
- Subject: Re: NSBrowser tooltips
- From: Ken Thomases <email@hidden>
- Date: Mon, 05 May 2014 17:15:52 -0500
On May 5, 2014, at 4:58 PM, Paul Wasmund wrote:
> I am using an NSBrowser to display items and my code is based on the ComplexBrowser sample from Apple. This uses browser features introduced in 10.6 and does not implement a NSMatrix to display columns. The only support I see for implementing tooltips is browser:shouldShowCellExpansionForRow:column: which does not allow for a custom tooltip, only the display of the entire cell contents if the cell contents doesn't fit in the column. Is there some way of implementing custom tooltips for any cell in the browser?
Well, it's not directly associated with cells, per se, but you can use -[NSView addToolTipRect:owner:userData:] to add a tooltip rect covering the whole browser view (and update it when its bounds change). Set the owner to an object which implements the NSToolTipOwner informal protocol – i.e. the -view:stringForToolTip:point:userData: method. In that method, you can translate from the point to a row and column and return an appropriate string.
Cheers,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden