Re: Ellipsis + Proper Expansion Frame + HScroll-Edit in 10.6 NSTableView (was "Clipped Tooltip")
Re: Ellipsis + Proper Expansion Frame + HScroll-Edit in 10.6 NSTableView (was "Clipped Tooltip")
- Subject: Re: Ellipsis + Proper Expansion Frame + HScroll-Edit in 10.6 NSTableView (was "Clipped Tooltip")
- From: Jerry Krinock <email@hidden>
- Date: Wed, 27 Jan 2010 19:44:57 -0800
On 2010 Jan 27, at 15:38, Corbin Dunn wrote:
> NSTableColumn's default cell is initialized with...
>
> NSTextFieldCell
> setEditable:YES
> setScrollable:YES
> setDrawsBackground:NO
> setFont:(systemFontSize)
> setLineBreak:NSLineBreakByTruncatingTail
> setBackgroundColor:[NSColor controlBackgroundColor]
Thanks again, Corbin. I tried it just like that it satisfied all 3 requirements. Then stripped it down, and found that the simplest answer is…
[aCell setScrollable:YES] ;
[aCell setLineBreakMode:NSLineBreakByTruncatingMiddle] ;
*in that order*
The documentation does not indicate any interaction between those two that would dictate the order. Also, this does not seem to work for NSTokenFieldCell. I didn't try that in the demo project though, because the override of expansionFrameWithFrame:inView: which I posted this morning works fine in that case. And since I can't really state *why* the above works, I'd rather have two different solutions in my code base in case one of them fails in Mac OS 10.7.
It does seem to be some kind of a bug that the frame-making and the text-drawing could get into a state where the former thinks that the text is wrapped and the latter does not. But then this is a fairly complicated problem, among -setWraps:, -setLineBreakMode:, -setScrollable:, and setTruncatesLastVisibleLine:, considering their overlapping meanings, with all the different values and sequences in which these messages could be sent there are -- who knows –– 2^8*(2^6-1) different combinations and interactions that could be tested and documented.
So, I got it working OK, and maybe the next person who needs to tinker will find this in the list archives. I hope that person ain't me :(
_______________________________________________
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