- buttonsizer = new wxBoxSizer( wxHORIZONTAL );
- buttonsizer->Add( new wxButton( this, wxID_OK ), 0, wxCENTER | wxALL, 5 );
- buttonsizer->Add( new wxButton( this, wxID_CANCEL ), 0, wxCENTER | wxALL, 5 );
- mainsizer->Add( buttonsizer, 0, wxALIGN_RIGHT );
+ wxSizer *bsizer = CreateButtonSizer( wxOK|wxCANCEL , false, 5 );
+ if(bsizer->GetChildren().GetCount() > 0 )
+ {
+ mainsizer->Add( bsizer, 0, wxEXPAND | wxALL, 5 );
+ }
+ else
+ {
+ delete bsizer;
+ }