Opened 8 years ago

Closed 8 years ago

#11780 closed defect (fixed)

Header control truncates text on OSX

Reported by: SnowLeopard Owned by:
Priority: normal Milestone: 2.9.1
Component: wxOSX Version: stable-latest
Keywords: OSX listctrl Cc:
Blocked By: Blocking:
Patch: no


OSX 10.6

List control headers truncate the "hanging" part of letters such as 'y' or 'q' because the header control is not tall enough.

I see that the header's height is initialized like this:

m_headerHeight = wxRendererNative::Get().GetHeaderButtonHeight(this);

Which in turns calls this:

GetThemeMetric( kThemeMetricListHeaderHeight, &standardHeight );

I guess logically this should work, but as you can see in attached screenshot the height of "17" that I got on my machine is not tall enough. If I had to guess, maybe this height is not taking into account the padding that would appear above and below the text in the header. If that is the problem, perhaps an extra 5 could be added for the necessary padding, like this:

m_headerHeight = wxRendererNative::Get().GetHeaderButtonHeight(this)+5;

Attachments (1)

Screen shot 2010-03-02 at 11.44.43 PM.png download (36.8 KB) - added by SnowLeopard 8 years ago.

Download all attachments as: .zip

Change History (5)

Changed 8 years ago by SnowLeopard

comment:1 Changed 8 years ago by vadz

  • Milestone set to 2.9.1

This clearly should be fixed somehow but I feel uncomfortable with just hardcoding the size like this. Maybe we should add GetCharHeight()/2 or something like this?

comment:2 Changed 8 years ago by robind

IIRC you can't force the size of the header to be larger because no matter the size of the control the drawing APIs will always use a fixed height and leave the rest (if any) untouched. So instead of clipping the tails you could end up with them hanging below the drawn header background.

What should probably be done instead is to either adjust the position that the text is drawn at, or the size of the font, or the size of the clipping region used when the text is drawn, or perhaps all of these.

comment:3 Changed 8 years ago by vadz

  • Status changed from new to confirmed

For some reason wxListCtrl set up the clipping region to exclude 4 bottom pixels of the header. Simply removing this fixes the problem (and just half an hour lost...).

comment:4 Changed 8 years ago by VZ

  • Resolution set to fixed
  • Status changed from confirmed to closed

(In [63947]) Fix over aggressive clipping in generic wxListCtrl header drawing.

Clipping out 4 pixels vertically resulted in truncating any letters with
descent (e.g. "g" or "q") under OS X where the native header size is just tall
enough to show the text.

Simply don't clip that much but use the entire header width.

Closes #11780.

Note: See TracTickets for help on using tickets.