AuiManger 4-way split screen

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
bandali99
Knows some wx things
Knows some wx things
Posts: 40
Joined: Fri Jul 05, 2019 3:58 pm

AuiManger 4-way split screen

Post by bandali99 » Wed Jul 31, 2019 3:49 pm

I am creating a 4-split screen using AUI (i know its easier with wxsplitterwindow but I am told to use Aui). I have my items on the frame however I am not able to split them evenly in the way I want. I want each textbox to occupy a corner of the screen.

here is the code that deals with the positioning, if anyone has any ideas that would be awesome

Code: Select all

		m_mgr.AddPane(text1, wxLEFT, wxT("Pane Number One"));
		m_mgr.AddPane(text2, wxBOTTOM, wxT("Pane Number Two"));
		m_mgr.AddPane(text3, wxCENTER);
		m_mgr.AddPane(text4, wxBOTTOM | wxRIGHT);

		m_mgr.Update();

User avatar
doublemax
Moderator
Moderator
Posts: 13902
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: AuiManger 4-way split screen

Post by doublemax » Wed Jul 31, 2019 4:52 pm

I want each textbox to occupy a corner of the screen.
To be clear: This layout can be done easily with sizers only. You only need additional controls when you want to make it user-resizable.

I'm not a wxAUI expert (actually i've never used it myself in 15 years), but i don't think you can create a "real" 4-way splitter with wxAUI (someone correct me if i'm wrong).

This is the best i could come up with:

Code: Select all

MyFrame::MyFrame(wxWindow* parent) : wxFrame(parent, -1, _("wxAUI Test"),
                                              wxDefaultPosition, wxDefaultSize,
                                              wxDEFAULT_FRAME_STYLE)                             
{
  CreateStatusBar();

  m_mgr = new wxAuiManager(this, wxAUI_MGR_DEFAULT);

  wxPanel *panel1 = new wxPanel(this, wxID_ANY); panel1->SetBackgroundColour(*wxRED);
  wxPanel *panel2 = new wxPanel(this, wxID_ANY); panel2->SetBackgroundColour(*wxGREEN);
  wxPanel *panel3 = new wxPanel(this, wxID_ANY); panel3->SetBackgroundColour(*wxBLUE);
  wxPanel *panel4 = new wxPanel(this, wxID_ANY); panel4->SetBackgroundColour(*wxYELLOW);

  m_mgr->AddPane(panel1, wxAuiPaneInfo().Name(_T("Pane11 Name")).Caption(_("Panel1 caption")).Center().Row(0).Position(0).Resizable().CloseButton(false));
  m_mgr->AddPane(panel2, wxAuiPaneInfo().Name(_T("Pane12 Name")).Caption(_("Panel2 caption")).Center().Row(0).Position(1).Resizable().CloseButton(false));
  m_mgr->AddPane(panel3, wxAuiPaneInfo().Name(_T("Pane13 Name")).Caption(_("Panel3 caption")).Center().Row(1).Position(0).Resizable().CloseButton(false));
  m_mgr->AddPane(panel4, wxAuiPaneInfo().Name(_T("Pane14 Name")).Caption(_("Panel4 caption")).Center().Row(1).Position(1).Resizable().CloseButton(false));

  m_mgr->Update();
}
You'll see its limitation immediately if you run it.
Use the source, Luke!

Post Reply