• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Ellipsis + Proper Expansion Frame + HScroll-Edit in 10.6 NSTableView (was "Clipped Tooltip")
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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: Tue, 26 Jan 2010 23:14:48 -0800

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 (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

  • Follow-Ups:
    • Re: Ellipsis + Proper Expansion Frame + HScroll-Edit in 10.6 NSTableView (was "Clipped Tooltip")
      • From: Corbin Dunn <email@hidden>
    • Re: Ellipsis + Proper Expansion Frame + HScroll-Edit in 10.6 NSTableView (was "Clipped Tooltip")
      • From: Jerry Krinock <email@hidden>
References: 
 >10.6 Clips Tooltip if you return NSTextFieldCell in -dataCellForRow: (From: Jerry Krinock <email@hidden>)
 >Re: 10.6 Clips Tooltip if you return NSTextFieldCell in -dataCellForRow: (From: Corbin Dunn <email@hidden>)

  • Prev by Date: Re: Change background color of UITabBarItem and UITabBar
  • Next by Date: Re: How to access iTunes using cocoa
  • Previous by thread: Re: 10.6 Clips Tooltip if you return NSTextFieldCell in -dataCellForRow:
  • Next by thread: Re: Ellipsis + Proper Expansion Frame + HScroll-Edit in 10.6 NSTableView (was "Clipped Tooltip")
  • Index(es):
    • Date
    • Thread