making pane get all available space

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
User avatar
cutecode
Super wx Problem Solver
Super wx Problem Solver
Posts: 427
Joined: Fri Dec 09, 2016 7:28 am
Contact:

making pane get all available space

Post by cutecode »

how to make the only tab pane always be docked maximized in a wxFrame?
what ever switches I've tried, it didn't help

Code: Select all

		if (GetMyFramePtr()->m_gTAB == NULL)
		{
			GetMyFramePtr()->m_gTAB = new wxMyAuiNotebook(GetMyFramePtr(), wxID_ANY, wxPoint(0, 0), wxSize(3000, 3000),
				wxAUI_NB_BOTTOM | wxAUI_NB_TAB_MOVE | wxNO_BORDER  | wxAUI_NB_TAB_FIXED_WIDTH | wxAUI_NB_WINDOWLIST_BUTTON);
			GetMyFramePtr()->m_mgr.AddPane(GetMyFramePtr()->m_gTAB, wxAuiPaneInfo().Name(wxT("notebook_content")).PaneBorder(false).CaptionVisible(false)
				);
		}

		GetMyFramePtr()->m_gTAB->AddPage(GetMyParent(), L" " + m_szTitle + L" ", true/*, page_bmp*/);
		GetMyFramePtr()->m_mgr.Update();
wx 3.1.6 win/mac/linux

regards,
Alexander Saprykin
https://v2.dental-soft.ru
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7477
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: making pane get all available space

Post by ONEEYEMAN »

Hi,
If its the only pane available - it should fill all client area.
Or are you talking about maximized state of the window?

Thank you.
User avatar
cutecode
Super wx Problem Solver
Super wx Problem Solver
Posts: 427
Joined: Fri Dec 09, 2016 7:28 am
Contact:

Re: making pane get all available space

Post by cutecode »

It should be docked, and take all client area of the main wxFrame.

But in my case it takes only 1/3 part of wxFrame. Don't know why.
My project is very complicated and it's hard to know where the 'bug' is.

Just whanted to know if there's any switch to force it take all client area.
wx 3.1.6 win/mac/linux

regards,
Alexander Saprykin
https://v2.dental-soft.ru
Nunki
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 235
Joined: Fri Sep 14, 2012 8:26 am
Location: Kontich, Belgium
Contact:

Re: making pane get all available space

Post by Nunki »

I think that Using sizers, the flag wxGROW and setting the stretch factor to 1 may get you on the road.

regards,
Nunki
User avatar
cutecode
Super wx Problem Solver
Super wx Problem Solver
Posts: 427
Joined: Fri Dec 09, 2016 7:28 am
Contact:

Re: making pane get all available space

Post by cutecode »

Nunki wrote:I think that Using sizers, the flag wxGROW and setting the stretch factor to 1 may get you on the road.

regards,
Nunki
Just tried sisers, and it didn't help, as expected.
It did took all the space of wxFrame, but it hides all my toolbars ot top of wxFrame.
wx 3.1.6 win/mac/linux

regards,
Alexander Saprykin
https://v2.dental-soft.ru
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7477
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: making pane get all available space

Post by ONEEYEMAN »

Hi,
What do you do differently from the auidemo?

I think it has the code that displays the notebook...

Thank you.
User avatar
cutecode
Super wx Problem Solver
Super wx Problem Solver
Posts: 427
Joined: Fri Dec 09, 2016 7:28 am
Contact:

Re: making pane get all available space

Post by cutecode »

ONEEYEMAN wrote: I think it has the code that displays the notebook...
Theory comforms whith practic only in theory
wx 3.1.6 win/mac/linux

regards,
Alexander Saprykin
https://v2.dental-soft.ru
Nunki
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 235
Joined: Fri Sep 14, 2012 8:26 am
Location: Kontich, Belgium
Contact:

Re: making pane get all available space

Post by Nunki »

Hi Alexander,

if this is what you're looking for...
[img]
fulltab.png
fulltab.png (11.98 KiB) Viewed 2116 times
[/img]

Basically I took a wxFrame (I use Dialogblocks for buiding the gui and use the generated xrc-files, but you can use the c++ code as well). First I added a wxPanel (needed for TAB traversal) then I added a vertical sizer (wxBoxSizerV) added a toolbar and a notebook. The toolbar I left default, but the notebook I used the wxGROW flag and the set stretch to 1.
So I get the toolbar on top with a tabbed pane completely taking up the free frame space.

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

Re: making pane get all available space

Post by doublemax »

I don't use wxAUI, but AFAIK the center pane is that one that gets all available space that's left by the docked panes on the sides.

So try adding CenterPane() to the auipanel flags for the notebook.
Use the source, Luke!
User avatar
cutecode
Super wx Problem Solver
Super wx Problem Solver
Posts: 427
Joined: Fri Dec 09, 2016 7:28 am
Contact:

Re: making pane get all available space

Post by cutecode »

doublemax wrote:I don't use wxAUI, but AFAIK the center pane is that one that gets all available space that's left by the docked panes on the sides.

So try adding CenterPane() to the auipanel flags for the notebook.
If I add flag CenterPane, the pane becomes right aligned.
If I remove this flag, the pane becomes left aligned.
Taking only half of free space in both cases

Code: Select all

	if (get_using_doiking_childs() == 3)
	{
		if (GetMyFramePtr()->m_gTAB == NULL)
		{
			wxSize client_size = GetMyFramePtr()->GetClientSize();
			GetMyFramePtr()->m_gTAB = new wxMyAuiNotebook(GetMyFramePtr(), wxID_ANY, wxPoint(0, 0), wxSize(client_size.x, client_size.y),
				wxAUI_NB_BOTTOM | wxAUI_NB_TAB_MOVE | wxNO_BORDER | wxAUI_NB_CLOSE_ON_ACTIVE_TAB | wxAUI_NB_MIDDLE_CLICK_CLOSE | wxAUI_NB_TAB_FIXED_WIDTH | wxAUI_NB_WINDOWLIST_BUTTON);

			GetMyFramePtr()->m_mgr.GetArtProvider()->SetColor(wxAUI_DOCKART_BACKGROUND_COLOUR, GetFormBgColor());
			//	wxAuiDockArt* ar = new wxAuiDockArt;

			if (USE_BACK_COLORS())
			{
				wxAuiSimpleTabArt* art = new wxAuiSimpleTabArt;
				art->SetColour(GetFormBgColor());
				GetMyFramePtr()->m_gTAB->SetArtProvider(art);

				::SetBackgroundColour(GetMyFramePtr()->m_gTAB, GetFormBgColor());
			}

//			GetMyFramePtr()->m_mgr.AddPane(GetMyFramePtr()->m_gTAB, wxAuiPaneInfo().Name(wxT("notebook_content")).PaneBorder(false).CaptionVisible(false).Row(1).DestroyOnClose().Layer(0).BestSize(client_size.x, client_size.y).MinSize(client_size.x, client_size.y).Maximize());
			GetMyFramePtr()->m_mgr.AddPane(GetMyFramePtr()->m_gTAB, wxAuiPaneInfo().Name(wxT("notebook_content")).PaneBorder(false).CaptionVisible(false).Row(1).DestroyOnClose().Layer(0).Maximize().CenterPane());

			GetMyFramePtr()->Connect(wxEVT_AUINOTEBOOK_PAGE_CLOSE, wxAuiNotebookEventHandler(ParentFrame::OnBeforeTabPageClose));

/*			wxBoxSizer * const sizerTop = new wxBoxSizer(wxVERTICAL);
			wxBoxSizer* m_staticBoxSizer = new wxBoxSizer(wxHORIZONTAL);
			m_staticBoxSizer->Add(GetMyFramePtr()->m_gTAB, 1, wxGROW | wxALL, 3);
			sizerTop->Add(m_staticBoxSizer, 1, wxGROW | wxALL);

			GetMyFramePtr()->SetSizer(sizerTop);
			sizerTop->Fit(GetMyFramePtr());
			GetMyFramePtr()->Layout();*/

		}

		GetMyFramePtr()->m_gTAB->AddPage(GetMyParent(), L" " + m_szTitle + L" ", true/*, page_bmp*/);
		GetMyFramePtr()->m_mgr.Update();
		GetMyParent()->Activate();
	}

if I add this flags

Code: Select all

BestSize(client_size.x, client_size.y).MinSize(client_size.x, client_size.y)
The pane does becomes maximizes, but in this case I cannot add a pane on the left side, because it shrinks to smallest size and cannot be resized
Attachments
Безымянный2.png
Безымянный2.png (53.06 KiB) Viewed 2099 times
Безымянный.png
Безымянный.png (47.76 KiB) Viewed 2099 times
wx 3.1.6 win/mac/linux

regards,
Alexander Saprykin
https://v2.dental-soft.ru
User avatar
doublemax
Moderator
Moderator
Posts: 19159
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: making pane get all available space

Post by doublemax »

Try to create a minimal, compilable codesample that people can try out.
Use the source, Luke!
User avatar
cutecode
Super wx Problem Solver
Super wx Problem Solver
Posts: 427
Joined: Fri Dec 09, 2016 7:28 am
Contact:

Re: making pane get all available space

Post by cutecode »

The only solution I've found so far, is to remove AddPane for AuiNoteBook, and catch OnSize() event and resize manaly this AuiNoteBook
Attachments
Безымянный3.png
Безымянный3.png (54.44 KiB) Viewed 2096 times
wx 3.1.6 win/mac/linux

regards,
Alexander Saprykin
https://v2.dental-soft.ru
Post Reply