On 2010 Jan 26, at 10:07, Corbin Dunn wrote:

> Look up "expansion tool tips".

Thanks!

> 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). 

Yes and no.  The value of -wraps is what counts, but I didn't do it.  (That's 
why I made the demo project.)  Out of the box, [[NSTextFieldCell alloc] init] 
has -wraps = YES.  This works fine in Mac OS 10.5, but in Mac OS 10.6, it 
causes the expansion frame to not bound its text (which yesterday I called 
"clipped").

The NSTextFieldCell returned by -[NSTableColumn dataCell] has -wraps = NO.  
That's why it works.

However, setting wraps:NO causes the ellipsis to not appear in the normal 
drawing, and/or causes the text to not scroll to the left when you bump into 
the right edge while editing.

Now, let me summarize -- I have three requirements:

1.  Properly-drawn expansion frame.
2.  Ellipsis appears when text overflows during normal drawing.
3.  When editing, text should scroll left when you bump into the right edge.

I considered three attributes of NSCell:

-wraps
-scrollable
-truncatesLastVisibleLine

Setting these to all eight possibilities (some are not allowed, since setWraps: 
sometimes affects -scrollable and vice versa), I found that there is no 
combination which satisfies all three requirements.

So then I tried overriding three methods:

drawWithFrame:inView:
drawWithExpansionFrame:inView:
editWithFrame:inView:editor:delegate:event:

so that I could change the values of the three attributes before.  But I am 
still unable to find the magic formula.

However, I know there is a magic formula somewhere, because when I use the 
default cell returned by -[NSTableColumn dataCell], all three requirements are 
satisfied.  Statically, I see that it sets all three attributes to NO.  But 
when I try this with a raw NSTextFieldCell, only requirement 1 is satisfied.

Maybe there is another attribute involved -- NSCell has several dozen more.  
Anybody got a good guess?

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to