Re: 10.6 Clips Tooltip if you return NSTextFieldCell in -dataCellForRow:
Re: 10.6 Clips Tooltip if you return NSTextFieldCell in -dataCellForRow:
- Subject: Re: 10.6 Clips Tooltip if you return NSTextFieldCell in -dataCellForRow:
- From: Corbin Dunn <email@hidden>
- Date: Tue, 26 Jan 2010 10:07:35 -0800
Jerry,
http://developer.apple.com/mac/library/documentation/cocoa/reference/ApplicationKit/Classes/NSCell_Class/Reference/NSCell.html
Look up "expansion tool tips".
Managing Expansion Frames
• – expansionFrameWithFrame:inView:
• – drawWithExpansionFrame:inView:
For what it is worth, using a normal NSTexTFieldCell should always work -- there is possibly something wrong with the way you have it setup (like allowing wrapping, or something).
Short answers inline:
On Jan 25, 2010, at 10:48 PM, Jerry Krinock wrote:
> I've been overriding -[NSTableColumn dataCellForRow:], returning a variation on NSTextFieldCell for years. However I just discovered that, in OS 10.6.2, this breaks the tooltip which shows the entire text when you hover over a truncated cell. (This tooltip feature was added in OS 10.5.) Here's how it looks:
>
> http://sheepsystems.com/engineering/ClippedToolTip.png [1]
>
> Here's the demo project:
>
> http://sheepsystems.com/engineering/ClippedToolTip.zip
>
> No problem either way in Mac OS X 10.5. Snow Leopard AppKit Release Notes don't mention anything about these tooltips.
> ...
> * Why in the world would Cocoa be invoking -dataCellForRow in order to display a tooltip? It always uses the same yellow box format with the same font. The tooltip should have no interest whatsoever in the data cell. But it's apparently getting the answer that it wants, a width of 343.968!
Because it is showing an expansion of the clipped cell; it is different than a normal tooltip.
>
> * How in the world does -[super dataCell] know that the required width of the text in this particular cell is 343.968? It does not even know the row or column, much less the data object value.
See the methods I mention above.
-corbin
_______________________________________________
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