I have a wxScrolledWindow which contains a wxFlexGridSizer..
I then add several instances of my custom control (inherits from wxPanel) where each one occupies a fixed height but expands to the width of the parent (which in this case is the wxScrolledWindow..)
The problem I seem to be getting is that when I add more custom controls than can fit in the client window the scrollbars do not seem to appear..
I'm using xrc for my app so I can't post the UI setup code however here's where I grab the wxScrolledWindow in my frame init:-
Code: Select all
wxScrolledWindow* pMyScrolled = (wxScrolledWindow*)FindWindowById(wxXmlResource::Get()->GetXRCID("My_Scrolled"),NULL);
wxFlexGridSizer* pScrolledSizer = (wxFlexGridSizer*)pMyScrolled->GetSizer();
// here we grab the size which comes out at around (996,565)
wxSize siz = pMyScrolled->GetSize();
siz = pScrolledSizer->GetSize();
MyCustomPanel* pItem = new MyCustomPanel(pMyScrolled, wxID_ANY, wxT("Item1"), true);
pEntCtrlSizer->Add(pItem, 5, wxALL | wxGROW);
pItem = new MyCustomPanel(pMyScrolled, wxID_ANY, wxT("Item2"));
pScrolledSizer->Add(pItem, 5, wxALL | wxGROW);
pItem = new MyCustomPanel(pMyScrolled, wxID_ANY, wxT("Item3"));
pScrolledSizer->Add(pItem, 5, wxALL | wxGROW);
pItem = new MyCustomPanel(pMyScrolled, wxID_ANY, wxT("Item4"));
pScrolledSizer->Add(pItem, 5, wxALL | wxGROW);
// here we grab the size again after adding our custom
// controls but the size is still (996,565) strangely?
siz = pMyScrolled->GetSize();
siz = pScrolledSizer->GetSize();
Since the wxScrolledWindow setup is all done automatically via the xrc i'm not sure why this value is coming out nor where it is coming from as in form builder no initial size is being set for it..
I'm at a loss as to where the issues are coming from & can't quite figure out what I need to do to get my scrolledwindow to show up the scrollbars where appropriate..