Reputation: 182
I need to have 3 panles in a frame in which left panel and right panel should be reziable by the user by dragging to left or right. I have done this using AUI manager but I would like to do the same without using AUI(may be sizers). Any ideas how to achieve this? I have tried as shown below but the i am not able to resize the panel.
MyFrame1::MyFrame1( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style ) { this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bSizer6;
bSizer6 = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizer7;
bSizer7 = new wxBoxSizer( wxHORIZONTAL );
m_panel11 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
bSizer7->Add( m_panel11, 5, wxEXPAND | wxALL, 5 );
bSizer7->Add( 0, 0, 1, wxEXPAND, 5 );
bSizer6->Add( bSizer7, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer9;
bSizer9 = new wxBoxSizer( wxHORIZONTAL );
m_panel12 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
bSizer9->Add( m_panel12, 1, wxEXPAND | wxALL, 5 );
bSizer6->Add( bSizer9, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer10;
bSizer10 = new wxBoxSizer( wxHORIZONTAL );
m_panel13 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
bSizer10->Add( m_panel13, 1, wxEXPAND | wxALL, 5 );
bSizer6->Add( bSizer10, 1, wxEXPAND, 5 );
this->SetSizer( bSizer6 );
this->Layout();
this->Centre( wxBOTH );
}
Upvotes: 1
Views: 3351
Reputation: 4554
It sounds like what you want to use is a wxSplitterWindow. You can find documentation for this class at http://docs.wxwidgets.org/3.0/classwx_splitter_window.html.
Upvotes: 2
Reputation: 1987
MyFrame1::MyFrame1(wxWindow* parent, wxWindowID id, const wxString& title,
const wxPoint& pos, const wxSize& size, long style) :
wxFrame(parent, id, title, pos, size, style)
{
// use a base panel, so that you have the same background colour between controls
// (panels in your case) too
wxPanel* basePanel = new wxPanel(this);
// create your controls; no need to add default values...
m_panel11 = new wxPanel(basePanel);
m_panel12 = new wxPanel(basePanel);
m_panel13 = new wxPanel(basePanel);
// create a sizer; one should be enough
wxSizer* bSizer = new wxBoxSizer(wxHORIZONTAL);
// add your controls to the sizer
bSizer->Add(m_panel11, 1, wxEXPAND|wxALL, 5);
bSizer->Add(m_panel12, 0, wxEXPAND|wxUP|wxDOWN|wxRIGHT, 5);
bSizer->Add(m_panel13, 1, wxEXPAND|wxUP|wxDOWN|wxRIGHT, 5);
// if you need different resizing proportion for each panel, read the description
// of proportion parameter in wxSizer:Add() docs
basePanel->SetSizer(bSizer);
}
Upvotes: 0