wxStaticBoxSizer weirdness

Martin Cote cote.martin at gmail.com
Wed Mar 5 12:39:19 PST 2008


Hi,
I'm unable to make the simplest static box test to work.  I want to create a
wxStaticBox with a button in it, but the button always appears above the
static box, hiding the box title.

I have this function which creates the static box:

wxWindow * MakeStaticBox( wxWindow * parent )
{
    wxStaticBoxSizer * sizer
        =3D new wxStaticBoxSizer( wxVERTICAL , parent , _T( "Test" ) ) ;

    wxButton * button
        =3D new wxButton( parent , wxID_ANY , _T( "Test" ) ) ;
    sizer->Add( button ) ;

    return sizer->GetStaticBox() ;
}

In my wxFrame subclass' constructor, I have this:

    wxSizer * const sizer =3D new wxBoxSizer( wxVERTICAL ) ;
    sizer->Add( MakeStaticBox( this ) , 1 , wxEXPAND | wxALL , 5 ) ;
    SetSizer( sizer ) ;
    Layout() ;

The static box appears fine within the frame, but the button is displayed
above the static box, as explained earlier.

What is missing?  The result is as if the 'sizer->Add' call in the
'MakeStaticBox' function has no effect.

Any help would be appreciated.
Martin Cote
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wx-users/attachments/20080305/bea=
53c9b/attachment.htm


More information about the wx-users mailing list