multiple wxwindows on fnb

BlitzMax Modules Forums/Brucey's Modules/multiple wxwindows on fnb

I've been playing around with wxPanels in flatnotebooks to achieve multiple things on one fnb page. The only problem is nothing will resize with the main window.

Do I have to manually change all the object dimensions for that page (including the panel) or is there another way to do this?

In the basic_notebook example the 3rd tab resizes due to the wxBoxSizer.
Are you using one of these?

		' another new panel
		panel = wxPanel.CreatePanel(notebook)

		Local mysizer:wxBoxSizer = wxBoxSizer.CreateBoxSizer(wxVERTICAL)
		panel.SetSizer(mysizer)
		
		textlog = wxTextCtrl.CreateTextCtrl(panel, TEXTBOX1, "Log~n", 0, 250, 100, 50, wxTE_MULTILINE)
		mysizer.Add(textlog, 1, wxEXPAND | wxALL, 5)
		
		notebook.AddPage(panel, "Tab3", False)


To have a control size along with its parent, you can either handle wxEVT_SIZE events yourself per parent control and do something appropriate for the children, or you might want to rather investigate Sizers, as Glenn mentions above.

Sizers take care of everything for you. All you need to do is set them up to work in the way you want them to.

There's a small guide as to how they work here : http://docs.wxwidgets.org/2.8.7/wx_sizeroverview.html

We probably needs *lots* more basic samples for wxMax to show stuff really... but that'll take an age and a half to get through... One day ;-)

I just used wxFormBuilder and wxCodeGen to make these.
Tab1 resizes, tab2 resizes, tab3 doesn't because the items don't have a Proportion size greater than 0
Plus the controls i picked don't show resizing to it full advantage but was simple to add to the gui.

Hope this helps in some way

NotebookTestGUI.bmx
'
' BlitzMax code generated with wxCodeGen v1.03 : 29 Mar 2008 20:25:33
' 
' 
' PLEASE DO "NOT" EDIT THIS FILE!
' 
SuperStrict

Import wx.wxButton
Import wx.wxComboBox
Import wx.wxFrame
Import wx.wxListBox
Import wx.wxNotebook
Import wx.wxPanel
Import wx.wxStaticText
Import wx.wxTextCtrl
Import wx.wxWindow


Type MyFrame1Base Extends wxFrame

	Field m_panel1:wxPanel
	Field m_notebook1:wxNotebook
	Field m_panel2:wxPanel
	Field m_button1:wxButton
	Field m_staticText1:wxStaticText
	Field m_panel3:wxPanel
	Field m_comboBox1:wxComboBox
	Field m_listBox1:wxListBox
	Field m_panel4:wxPanel
	Field m_button2:wxButton
	Field m_staticText2:wxStaticText
	Field m_textCtrl1:wxTextCtrl


	Method Create:MyFrame1Base(parent:wxWindow = Null,id:Int = wxID_ANY, title:String = "", x:Int = -1, y:Int = -1, w:Int = 500, h:Int = 300, style:Int = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL)
		Return MyFrame1Base(Super.Create(parent, id, title, x, y, w, h, style))
	End Method

	Method OnInit()

		Local bSizer1:wxBoxSizer
		bSizer1 = New wxBoxSizer.Create(wxVERTICAL)
		m_panel1 = New wxPanel.Create(Self, wxID_ANY,,,,, wxTAB_TRAVERSAL)

		Local bSizer2:wxBoxSizer
		bSizer2 = New wxBoxSizer.Create(wxVERTICAL)
		m_notebook1 = New wxNotebook.Create(m_panel1, wxID_ANY)
		m_panel2 = New wxPanel.Create(m_notebook1, wxID_ANY,,,,, wxTAB_TRAVERSAL)

		Local bSizer3:wxBoxSizer
		bSizer3 = New wxBoxSizer.Create(wxVERTICAL)
		m_button1 = New wxButton.Create(m_panel2, wxID_ANY, "MyButton")
		bSizer3.Add(m_button1, 1, wxALL, 5)

		m_staticText1 = New wxStaticText.Create(m_panel2, wxID_ANY, "MyLabel")
		m_staticText1.Wrap(-1)
		bSizer3.Add(m_staticText1, 1, wxALL, 5)

		m_panel2.SetSizer(bSizer3)
		m_panel2.Layout()
		m_notebook1.AddPage(m_panel2, "a page", False)

		m_panel3 = New wxPanel.Create(m_notebook1, wxID_ANY,,,,, wxTAB_TRAVERSAL)

		Local bSizer4:wxBoxSizer
		bSizer4 = New wxBoxSizer.Create(wxVERTICAL)
		m_comboBox1 = New wxComboBox.Create(m_panel3, wxID_ANY, "Combo!", Null)
		bSizer4.Add(m_comboBox1, 1, wxALL, 5)

		m_listBox1 = New wxListBox.Create(m_panel3, wxID_ANY, Null)

		bSizer4.Add(m_listBox1, 1, wxALL, 5)

		m_panel3.SetSizer(bSizer4)
		m_panel3.Layout()
		m_notebook1.AddPage(m_panel3, "a page", False)

		m_panel4 = New wxPanel.Create(m_notebook1, wxID_ANY,,,,, wxTAB_TRAVERSAL)

		Local bSizer5:wxBoxSizer
		bSizer5 = New wxBoxSizer.Create(wxHORIZONTAL)
		m_button2 = New wxButton.Create(m_panel4, wxID_ANY, "MyButton")
		bSizer5.Add(m_button2, 0, wxALL, 5)

		m_staticText2 = New wxStaticText.Create(m_panel4, wxID_ANY, "MyLabel")
		m_staticText2.Wrap(-1)
		bSizer5.Add(m_staticText2, 0, wxALL, 5)

		m_textCtrl1 = New wxTextCtrl.Create(m_panel4, wxID_ANY, "")
		m_textCtrl1.SetMaxLength(0)
		bSizer5.Add(m_textCtrl1, 0, wxALL, 5)

		m_panel4.SetSizer(bSizer5)
		m_panel4.Layout()
		m_notebook1.AddPage(m_panel4, "a page", False)


		bSizer2.Add(m_notebook1, 1, wxEXPAND | wxALL, 5)

		m_panel1.SetSizer(bSizer2)
		m_panel1.Layout()
		bSizer1.Add(m_panel1, 1, wxEXPAND | wxALL, 5)

		SetSizer(bSizer1)
		Layout()

	End Method

End Type



NotebookTest.bmx
'
' Example application stub generated by wxCodeGen v1.03 : 29 Mar 2008 20:22:02
'
SuperStrict

Framework wx.wxApp

Import "NotebookTestGUI.bmx"

New MyApp.run()

Type MyApp Extends wxApp

	Method OnInit:Int()

?macos
		' make the default Mac font for controls not so big
		wxSystemOptions.SetOption(wxWINDOW_DEFAULT_VARIANT, wxWINDOW_VARIANT_SMALL)
?
		' needed so my graphics show up
		wxInitAllImageHandlers()
		' for Mac/Win32 (it is default on Linux)
		wxImage.AddHandler( New wxXPMHandler )
		
		' create the frame
		Local frame:MyFrame1 = MyFrame1(New MyFrame1.Create(, , "Notebook Test"))
		' frames are created hidden. You need to manually show it.
		frame.show()
		' make sure it is brought to the front
		SetTopWindow(frame)
		Return True
	End Method

End Type



Type MyFrame1 Extends MyFrame1Base

	Method OnInit()
		Super.OnInit()

		' Add own initialisation code here

	End Method

End Type



EDIT2: NEVERMIND!! I was just being an idiot, thanks alot.