Kirix Support Forums

Sizer problems inwxAUI

Please post all general questions, comments, bug reports, and any other wxAUI feedback here.

Sizer problems inwxAUI

Postby JonPan on Thu Dec 30, 2010 10:20 am

I have been trying to use a sizer with a number of controls on it managed within one pane of a multi-pane display.

I create a wxPanel with a sizer on it, add controls then add the panel to the AUIManager. The controls seem to be sized but are not respecting the bar at the top of the pane, they are justified all the way to the top they are also covered by what looks like the background of the pane. I hope I am just missing some settings but I cannot find any examples or comments of similar problems as a guide.

below is code which demostrates the problem and based on the simplest modification of the sample code from wxWidgets site. I put the whole app code in so you can compile and see the results, sorry if that is too much.

wxWidgets 2.8.10

Any thoughts?

Thanks in advance

Code: Select all

#include "wx/wx.h"

#include <wx/aui/aui.h>

class MyFrame : public wxFrame {
     wxAuiManager m_mgr;
   MyFrame(wxWindow* parent) : wxFrame(parent, -1, _("wxAUI Test"),
                      wxDefaultPosition, wxSize(800,600),
     // notify wxAUI which frame to use

     // create several text controls
     wxBoxSizer* m_pSizer = new wxBoxSizer(wxHORIZONTAL);
      wxPanel* win = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(400, 400));
      //wxFrame* win = new wxFrame(this, wxID_ANY, wxT("Test"), wxDefaultPosition, wxSize(400, 400));

      wxButton* ButtonAdd = new wxButton( this, wxID_ANY, _("Add"), wxDefaultPosition, wxSize(50, 50) );
     m_pSizer->Add(ButtonAdd, 1, wxGROW | wxALL | wxALIGN_CENTER, 5);
      wxButton* ButtonSave = new wxButton( this, wxID_ANY, _("Save"), wxDefaultPosition, wxSize(50, 50) );
     m_pSizer->Add(ButtonSave, 1, wxGROW | wxALL | wxALIGN_CENTER, 5);
      wxButton* ButtonDelete = new wxButton( this, wxID_ANY, _("Delete"), wxDefaultPosition, wxSize(50, 50) );
     m_pSizer->Add(ButtonDelete, 1, wxGROW | wxALL | wxALIGN_CENTER, 5);

     wxTextCtrl* text2 = new wxTextCtrl(this, -1, _("Pane 2 - sample text"),
                      wxDefaultPosition, wxSize(200,150),
                      wxNO_BORDER | wxTE_MULTILINE);
     wxTextCtrl* text3 = new wxTextCtrl(this, -1, _("Main content window"),
                      wxDefaultPosition, wxSize(200,150),
                      wxNO_BORDER | wxTE_MULTILINE);
     // add the panes to the manager
     m_mgr.AddPane(win, wxLEFT, wxT("Pane Number One"));
     m_mgr.AddPane(text2, wxBOTTOM, wxT("Pane Number Two"));
     m_mgr.AddPane(text3, wxCENTER);
     // tell the manager to "commit" all the changes just made


     // deinitialize the frame manager


  // our normal wxApp-derived class, as usual
class MyApp : public wxApp {

   bool OnInit()
     wxFrame* frame = new MyFrame(NULL);
     return true;                   


Registered User
Posts: 1
Joined: Thu Dec 30, 2010 9:51 am

Return to wxAUI Questions, Thoughts & Feedback