Opened 5 years ago

Closed 4 years ago

#11309 closed defect (fixed)

Generic listctrl in report mode on Mac does not create header

Reported by: dconnet Owned by:
Priority: high Milestone: 2.9.1
Component: wxOSX-Carbon Version: stable-latest
Keywords: wxListCtrl regression Cc: neno.ganchev@…
Blocked By: Blocking:
Patch: yes

Description

Compile the listctrl sample on Mac

  • Click View->Mac: Use Generic Control
  • View->List view
  • View->Report view

Note: No header.

  • Turn generic control off
  • toggle list/report modes to recreate list, header appears

In version 2.8.10, a header does appear.

Attachments (1)

update.diff download (464 bytes) - added by SnowLeopard 5 years ago.
Patch file

Download all attachments as: .zip

Change History (10)

comment:1 Changed 5 years ago by vadz

  • Keywords wxListCtrl regression added
  • Milestone set to 2.9.1
  • Status changed from new to confirmed

At least with wxOSX/Cocoa (which, I think, always uses the generic implementation) the header never appears at all. This is indeed a bad problem.

comment:2 Changed 5 years ago by SnowLeopard

This is (maybe) a sizer issue, although for the life of me I can't figure out the fix.

I tracked this down to "src/generic/listctrl.cpp", line 4312.

In the function "CreateOrDestroyHeaderWindowAsNeeded", if I change this line:

GetSizer()->Prepend( m_headerWin, 0, wxGROW );

to this:

GetSizer()->Prepend( m_headerWin, 1, wxGROW );

then the header control appears, although now its height is huge. My only guess is that the "wxGROW" parameter is being ignored and the headerctl is not being horizontally stretched unless I tell it to be vertically stretched too (by changing 0 to 1 in the second parameter). That makes no sense, but that appears to be what's happening. I tried every sizer hackery I could think of, but I couldn't get this control to stretch horizontally unless I made it stretch vertically too (which of course looks awful). I hope this helps.

P.S.
I'm using Cocoa, so I assume wxOSX just always uses the generic list control.

Changed 5 years ago by SnowLeopard

Patch file

comment:3 Changed 5 years ago by SnowLeopard

  • Patch set

Yes, this was a sizer issue. By adding a line to tell the main sizer of the header control's minimum height, it is now working under OSX. Attached is a patch with this fix.

comment:4 Changed 5 years ago by talon_karrde

  • Cc neno.ganchev@… added

comment:5 Changed 5 years ago by SC

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

(In [63177]) applying patch, closes #11309

comment:6 follow-up: Changed 4 years ago by vadz

  • Resolution fixed deleted
  • Status changed from closed to reopened

Sorry but this patch just doesn't make sense to me, this call shouldn't be needed because the sizer should already never shrink the header beneath its initial size which is exactly what is being passed to SetItemMinSize() anyhow.

Could anybody please check that this still doesn't work without this patch with the latest svn trunk? I think it really should and if it doesn't we should fix the bug in wxSizer itself and not here.

comment:7 in reply to: ↑ 6 Changed 4 years ago by talon_karrde

Replying to vadz:

Could anybody please check that this still doesn't work without this patch with the latest svn trunk?

I've just tested it without the patch (I'm currently using trunk@r63457) and the listctrl headers are shown. FYI we did have this exact problem and the patch had fixed it, but it seems it is no longer needed.

comment:8 Changed 4 years ago by vadz

Thanks for testing!

comment:9 Changed 4 years ago by vadz

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

Fix undone in r63662 (but the ticket wasn't modified automatically somehow...).

Note: See TracTickets for help on using tickets.