I have an instance of "wxNotebook", with 4 pages in it. Previously, all 4 pages were adjusted to be of the same height by manipulating the height of the controls in each page.
But now, I added a few more controls in one of the pages. This increased the height of the remaining 3 pages as well. But it looks odd, since there is only extra space being added at the end, just to make the height of all pages the same.
Is there a way to let this happen automatically, without me having to increase the height of the controls in the remaining pages each time some new control is added to one of the pages?
Please help!
wxNotebook with 4 pages - how to manage change in height?
Re: wxNotebook with 4 pages - how to manage change in height?
Hi,
Do you use sizers?
Thank you.
Do you use sizers?
Thank you.
Re: wxNotebook with 4 pages - how to manage change in height?
Hi,
Yes, every page has an associated sizer. And the notebook itself also has a sizer associated.
Thank you!
Yes, every page has an associated sizer. And the notebook itself also has a sizer associated.
Thank you!
Re: wxNotebook with 4 pages - how to manage change in height?
If hope you don't mean simple controls like buttons and textboxes that are supposed to have a standard height.Previously, all 4 pages were adjusted to be of the same height by manipulating the height of the controls in each page.
For other controls setting the proportion parameter and wxEXPAND flag correctly should do the trick. I can't be more specific without seeing the layout.
Use the source, Luke!
Re: wxNotebook with 4 pages - how to manage change in height?
Please see the screenshot below (sorry had to blur out some parts since its our official app). The arrow shows the extra space which has cropped up after adding new controls to another page. Is there a way the listbox and other controls at the right (static texts and buttons) can automatically place themselves according to the height of the page, instead of having to re-adjust the height of each control whenever new controls are added to another page? Please help!
And this is how the listbox is created:
wxBoxSizer* boxSizerNetworkFolderList = new wxBoxSizer(wxHORIZONTAL);
m_panelNetworkFolderControls->SetSizer(boxSizerNetworkFolderList);
wxArrayString m_listBoxNetworkFoldersArr;
m_listBoxNetworkFolders = new wxListBox(m_panelNetworkFolderControls, ID_NETWORKFOLDER_LIST, wxDefaultPosition, wxSize(250,320),
m_listBoxNetworkFoldersArr, wxLB_HSCROLL|wxLB_SINGLE|wxLB_SORT);
boxSizerNetworkFolderList->Add(m_listBoxNetworkFolders, 0, wxALL|wxEXPAND, 5);
And this is how the listbox is created:
wxBoxSizer* boxSizerNetworkFolderList = new wxBoxSizer(wxHORIZONTAL);
m_panelNetworkFolderControls->SetSizer(boxSizerNetworkFolderList);
wxArrayString m_listBoxNetworkFoldersArr;
m_listBoxNetworkFolders = new wxListBox(m_panelNetworkFolderControls, ID_NETWORKFOLDER_LIST, wxDefaultPosition, wxSize(250,320),
m_listBoxNetworkFoldersArr, wxLB_HSCROLL|wxLB_SINGLE|wxLB_SORT);
boxSizerNetworkFolderList->Add(m_listBoxNetworkFolders, 0, wxALL|wxEXPAND, 5);
Re: wxNotebook with 4 pages - how to manage change in height?
You have to consider the whole sizer structure from the top.
Assuming the toplevel sizer is a vertical boxsizer, and there is another horizontal boxsizer that contains the listbox and the controls next to it:
- add the listbox sizer to the toplevel sizer with a proportion of "1". This makes just that this sizer expands to the bottom.
- when adding the listbox to the listbox sizer, add the wxEXPAND flag, so it expands in the vertical direction.
You're already doing the second thing, so i guess you didn't set the proportion in the first step.
I don't understand what you want to happen with the controls on the right. They can't grow to the bottom in a sensible way, i would keep them as they are.
Assuming the toplevel sizer is a vertical boxsizer, and there is another horizontal boxsizer that contains the listbox and the controls next to it:
- add the listbox sizer to the toplevel sizer with a proportion of "1". This makes just that this sizer expands to the bottom.
- when adding the listbox to the listbox sizer, add the wxEXPAND flag, so it expands in the vertical direction.
You're already doing the second thing, so i guess you didn't set the proportion in the first step.
I don't understand what you want to happen with the controls on the right. They can't grow to the bottom in a sensible way, i would keep them as they are.
Use the source, Luke!
Re: wxNotebook with 4 pages - how to manage change in height?
@doublemax, thanks a lot for your response.
Setting the proportion to 1 helped the listbox expand till the bottom.
Isn't there anything we can do with the remaining controls at the right? Introducing an empty static text between the controls seems to be the only way to me..so that they are evenly spaced out, instead of too much space at the bottom.
Is there a better way than this?
Setting the proportion to 1 helped the listbox expand till the bottom.
Isn't there anything we can do with the remaining controls at the right? Introducing an empty static text between the controls seems to be the only way to me..so that they are evenly spaced out, instead of too much space at the bottom.
Is there a better way than this?
Re: wxNotebook with 4 pages - how to manage change in height?
Firstly, I agree with doublemax that leaving those control alone is probably the best idea.deepti wrote:Isn't there anything we can do with the remaining controls at the right? Introducing an empty static text between the controls seems to be the only way to me..so that they are evenly spaced out, instead of too much space at the bottom.
Is there a better way than this?
But, if you still want to space them over the area, what about using expandable spacers (wxSizer::AddStretchSpacer())?