• 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
NSTableColumn width computation doesn't work correctly on macOS 11
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTableColumn width computation doesn't work correctly on macOS 11


  • Subject: NSTableColumn width computation doesn't work correctly on macOS 11
  • From: Andreas Falkenhahn via Cocoa-dev <email@hidden>
  • Date: Fri, 25 Jun 2021 16:22:01 +0200

I'm manually calculating the minimum size of my NSTableColumn to avoid text
ellipsization. The calculation looks like this:

   NSCell *cell = [m_view preparedCellAtColumn:m_column row:row];

   int width = ceil([cell cellSize].width);

   if(m_column == [m_view outlineTableColumn]) {
      width += [m_view indentationPerLevel] * [m_view levelForRow:row];
      width += m_expander;
   }

The m_expander value is calculated like this:

   // assume that row 0 has an expander
   NSRect rc = [m_view frameOfOutlineCellAtRow:0];
   m_expander = ceil(rc.origin.x + rc.size.width);

This works nicely on 10.13. See here: https://imgur.com/w8uT4gu

On macOS 11, however, the calculation is not correct and the text gets
ellipsized, see here: https://imgur.com/HiOBVjh

Debugging has shown that m_expander is missing 4 pixels on macOS 11. On macOS
10.13 rc.origin.x is 6 and rc.size.width is 12. On macOS 11, rc.origin.x is 2
and rc.size.width is 12. However, this seems to be correct because you can see
that the space to the left of the expander is smaller on macOS 11 than on macOS
10.13 so the values look correct. All other values are identical between 10.13
and 11. The column width computed by 10.13 is 169 and the column width computed
by macOS 11 is 165.

Still, as you can see, the overall column width calculation is not correct on
macOS 11 because the text gets ellipsized. Anybody got an idea what the problem
here is?

--
Best regards,
 Andreas Falkenhahn                          mailto:email@hidden

_______________________________________________

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: NSTableColumn width computation doesn't work correctly on macOS 11
      • From: Rob Petrovec via Cocoa-dev <email@hidden>
  • Prev by Date: Re: Distributing Mac App to Registered Devices
  • Next by Date: Re: NSTableColumn width computation doesn't work correctly on macOS 11
  • Previous by thread: Re: Distributing Mac App to Registered Devices
  • Next by thread: Re: NSTableColumn width computation doesn't work correctly on macOS 11
  • Index(es):
    • Date
    • Thread