(I have tagged this question as Python as well since I understand Python code so examples in Python are also welcome!).
I want to create a simple window in wxWidgets:
I create a main panel which I add to a form
I associate a boxsizer to the main panel (splitting it in two, horizontally).
I add LeftPanel to the boxsizer,
I add RightPanel to the boxsizer,
I create a new boxsizer (vertical)
I create another boxsizer (horizontal)
I create a Notebook widget
I create a Panel and put it inside the Notebook (addpage)
I add the notebook to the new boxsizer (vertical one)
I add the vertical sizer in the horizontal one
I associate the horizontal sizer to the RightPanel
I add the Left and Right panel to the main sizer.
This doesn't work...
Maybe I have missed something (mental block about sizers) but what I would like to do is to expand the notebook widget without the use of the vertical sizer inside the horizontal one (it doesn't work anyway).
So my question is. Assuming I want to expand the Notebook widget inside the RightPanel to take up the rest of the right side area of the form, how would I go about doing that?
For those that understand Erlang, This is what I have so far:
mainwindow() ->
%% Create new environment
X = wx:new(),
%% Create the main frame
MainFrame = wxFrame:new(X, -1, "Test"),
MainPanel = wxPanel:new(MainFrame, [{winid, ?wxID_ANY}]),
MainSizer = wxBoxSizer:new(?wxHORIZONTAL),
wxWindow:setSizer(MainPanel, MainSizer),
%% Left Panel...
LeftPanel = wxPanel:new(MainPanel, [{winid, ?wxID_ANY}]),
LeftPanelSizer = wxBoxSizer:new(?wxVERTICAL),
wxWindow:setSizer(LeftPanel, LeftPanelSizer),
wxWindow:setMinSize(LeftPanel, {152, -1}),
%% Right Panel
RightPanel = wxPanel:new(MainPanel, [{winid, ?wxID_ANY}]),
RightPanelVerticalSizer = wxBoxSizer:new(?wxVERTICAL),
RightPanelHorizontalSizer = wxBoxSizer:new(?wxHORIZONTAL),
wxWindow:setBackgroundColour(RightPanel, {255,0,0}),
Notebook = wxNotebook:new(RightPanel, ?wxID_ANY, [{size,{-1,-1}}]),
TestPanel1 = wxPanel:new(Notebook, [{size,{-1,-1}},{winid, ?wxID_ANY}]),
wxNotebook:addPage(Notebook, TestPanel1, "Testpanel!"),
TestPanel2 = wxPanel:new(Notebook, [{size,{-1,-1}},{winid, ?wxID_ANY}]),
wxNotebook:addPage(Notebook, TestPanel2, "Testpanel!"),
wxSizer:add(RightPanelVerticalSizer, Notebook, [{border,0},{proportion,1}, {flag,?wxEXPAND}]),
wxSizer:add(RightPanelHorizontalSizer, RightPanelVerticalSizer, [{proportion,1}, {flag,?wxEXPAND}]),
wxWindow:setSizer(RightPanel, RightPanelHorizontalSizer),
%% Main Sizer
wxSizer:add(MainSizer, LeftPanel, [{border, 2}, {flag,?wxEXPAND bor ?wxALL}]),
wxSizer:add(MainSizer, RightPanel, [{border, 2}, {flag,?wxEXPAND bor ?wxTOP bor ?wxRIGHT bor ?wxBOTTOM}]),
%% Connect to events
wxFrame:connect(MainFrame, close_window),
wxWindow:center(MainFrame),
wxWindow:show(MainFrame),
...