Opened 6 years ago

Closed 5 years ago

#14698 closed defect (fixed)

Empty wxStaticBoxSizers aren't properly displayed

Reported by: dghart Owned by:
Priority: low Milestone: 3.0.0
Component: GUI-all Version: stable-latest
Keywords: empty wxStaticBoxSizer display Cc: juliansmart
Blocked By: Blocking:
Patch: no


The wxStaticBox of an empty wxStaticBoxSizer is displayed at the top-left of its parent container. This can most easily be seen in the 'controls section of the xrcdemo, but the attached patch to 'minimal' also demonstrates the issue. Adding a child to the sizer makes the display normal.

This bisects to r65079 "Don't show empty sizers" and, as suggested, the wxRESERVE_SPACE_EVEN_IF_HIDDEN flag fixes the issue. However I wonder if wxStaticBoxSizer should be an exception to the "Don't show" rule.

Even if not, the xrcdemo should be fixed, presumably with wxRESERVE_SPACE_EVEN_IF_HIDDEN. I'll attach before/after screenshots of it.

Attachments (3)

xrcdemo.png download (10.1 KB) - added by dghart 6 years ago.
xrcdemo_with_wxRESERVE_SPACE_EVEN_IF_HIDDEN.png download (10.2 KB) - added by dghart 6 years ago.
minimal.diff download (801 bytes) - added by dghart 6 years ago.

Download all attachments as: .zip

Change History (5)

Changed 6 years ago by dghart

Changed 6 years ago by dghart

comment:1 Changed 6 years ago by vadz

  • Cc juliansmart added
  • Milestone changed from 2.9.5 to 3.0
  • Priority changed from normal to low
  • Status changed from new to confirmed

Thanks for the report, I do see the bug and agree that something needs to be done about it. AFAICS we have 2 choices:

  1. Don't show empty wxStaticBoxSizers at all, i.e. not even the box.
  2. Ensure that IsShown() returns true for wxStaticBoxSizer even if they don't have any children.

I think (2) makes more sense because they're still visible, after all, and hiding the box would probably be unexpected.

Julian, would this affect DialogBlocks in any way? Do you have any preferences here?

comment:2 Changed 5 years ago by VZ

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

(In [73729]) Fix display of empty wxStaticBoxSizers.

wxStaticBoxSizer should be considered shown if its static box is shown, even
if it has no elements (or all of them are hidden).

Closes #14698.

Note: See TracTickets for help on using tickets.