Getting a splitter to fill the whole window Topic is solved

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
sfpiano
Earned a small fee
Earned a small fee
Posts: 23
Joined: Thu Jul 12, 2007 5:55 pm

Getting a splitter to fill the whole window

Post by sfpiano » Tue Jun 03, 2008 1:34 am

I want my main splitter to fill the entire size of the frame. Currently it is a static size and does not expand when I expand the window.

Code: Select all

MainFrame::MainFrame( 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 );

	m_statusBar1 = this->CreateStatusBar( 1, wxST_SIZEGRIP, wxID_ANY );
	menuBar = new wxMenuBar( 0 );
	FileMenu = new wxMenu();
	menuBar->Append( FileMenu, wxT("&File") );

	HelpMenu = new wxMenu();
	menuBar->Append( HelpMenu, wxT("&Help") );

	this->SetMenuBar( menuBar );

	toolBar = this->CreateToolBar( wxTB_HORIZONTAL, wxID_ANY ); 
	//toolBar->AddTool( wxID_ANY, wxT("Add Recipe"), wxNullBitmap, wxNullBitmap, wxITEM_NORMAL, wxEmptyString, wxEmptyString );
	toolBar->Realize();

	wxFlexGridSizer* fgSizer2;
	fgSizer2 = new wxFlexGridSizer( 1, 2, 0, 0 );
	fgSizer2->SetFlexibleDirection( wxBOTH );
	fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );

	m_splitter2 = new wxSplitterWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3D | wxSP_3DSASH | wxSP_NO_XP_THEME);
	m_splitter2->Connect( wxEVT_IDLE, wxIdleEventHandler( MainFrame::m_splitter2OnIdle ), NULL, this );
	m_panel1 = new wxPanel( m_splitter2, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
	wxBoxSizer* bSizer3;
	bSizer3 = new wxBoxSizer( wxVERTICAL );

	m_splitter4 = new wxSplitterWindow( m_panel1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3D | wxSP_3DSASH | wxSP_NO_XP_THEME);
	m_splitter4->Connect( wxEVT_IDLE, wxIdleEventHandler( MainFrame::m_splitter4OnIdle ), NULL, this );
	m_panel3 = new wxPanel( m_splitter4, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
	wxBoxSizer* bSizer4;
	bSizer4 = new wxBoxSizer( wxVERTICAL );

	m_treeCtrl6 = new wxTreeCtrl( m_panel3, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_DEFAULT_STYLE );
	wxTreeItemId iid = m_treeCtrl6->AddRoot(_T("root"));
	m_treeCtrl6->AppendItem(iid, _T("child"));
	m_treeCtrl6->AppendItem(iid, _T("child2"));
	m_treeCtrl6->SetMinSize(wxSize(120, 40));
	bSizer4->Add( m_treeCtrl6, 0, wxALL, 5 );

	m_panel3->SetSizer( bSizer4 );
	m_panel3->Layout();
	bSizer4->Fit( m_panel3 );
	m_panel4 = new wxPanel( m_splitter4, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
	wxBoxSizer* bSizer5;
	bSizer5 = new wxBoxSizer( wxVERTICAL );

	m_listCtrl3 = new wxListCtrl( m_panel4, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_ICON );
	m_listCtrl3->InsertItem(0, _T("List Item 1"));
	m_listCtrl3->InsertItem(1, _T("List Item 2"));
	m_listCtrl3->InsertItem(2, _T("List Item 3"));
	m_listCtrl3->InsertItem(3, _T("List Item 4"));
	bSizer5->Add( m_listCtrl3, 0, wxALL, 5 );

	m_panel4->SetSizer( bSizer5 );
	m_panel4->Layout();
	bSizer5->Fit( m_panel4 );
	m_splitter4->SplitVertically( m_panel3, m_panel4, 0 );
	bSizer3->Add( m_splitter4, 1, wxEXPAND, 5 );

	m_panel1->SetSizer( bSizer3 );
	m_panel1->Layout();
	bSizer3->Fit( m_panel1 );
	m_panel2 = new wxPanel( m_splitter2, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
	wxBoxSizer* bSizer1;
	bSizer1 = new wxBoxSizer( wxVERTICAL );

	m_treeCtrl3 = new wxTreeCtrl( m_panel2, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_DEFAULT_STYLE );
	bSizer1->Add( m_treeCtrl3, 0, wxALL, 5 );

	m_listBox1 = new wxListBox( m_panel2, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); 
	bSizer1->Add( m_listBox1, 0, wxALL, 5 );

	m_panel2->SetSizer( bSizer1 );
	m_panel2->Layout();
	bSizer1->Fit( m_panel2 );
	m_splitter2->SplitVertically( m_panel1, m_panel2, 258 );
	fgSizer2->Add( m_splitter2, 1, wxEXPAND, 5 );

	this->SetSizer( fgSizer2 );
	this->Layout();
}

timg
Earned some good credits
Earned some good credits
Posts: 148
Joined: Mon Jan 23, 2006 6:52 pm

Post by timg » Tue Jun 03, 2008 2:28 am

Did you try:

Code: Select all

fgSizer2->AddGrowableCol(0);
fgSizer2->AddGrowableRow(0);

sfpiano
Earned a small fee
Earned a small fee
Posts: 23
Joined: Thu Jul 12, 2007 5:55 pm

Post by sfpiano » Tue Jun 03, 2008 2:37 am

No I did not, thanks.

Post Reply