Hello ardi,
Saturday, May 5, 2012, 12:40:55 AM, you wrote:
a> Not exactly, because the size of this "special" wxPanel is always the
a> size of the ScrolledWindow, but I need it to be the size of the real,
a> large, wxPanel. Yes, I know, that's the SetVirtualSize(), but this
a> VirtualSize thing is confusing me enormously, because the placement
a> and size of my child controls depend on the size of the wxPanel, and
a> so I can't use the standard GetSize() and SetSize() calls. Instead I
a> need to go the VirtualSize path, and even then, I didn't manage it to
a> work.
a> In other words, imagine I've a 500x500 wxScrolledWindow driving a
a> 1000x1000 wxPanel. I need that child controls have no idea of the
a> 500x500 scroll area. They should just know that they belong to a
a> 1000x1000 wxPanel, and all their positions, sizes, etc should be
a> unaware of the 500x500 area... that 500x500 area shouldn't exist for
a> them.
You're overcomplicating things, in this scenario you don't have to
worry about the virtual vs visual size at all.
Take the "minimal" sample and add these few lines at the end of the
MyFrame ctor.
If the frame is too small to display the 16 buttons, you'll see
scrollbars. If not, it'll look just like a wxPanel.
HTH
Eric
---
wxScrolledWindow *panel = new wxScrolledWindow(this, wxID_ANY);
wxSizer *sizer = new wxBoxSizer(wxVERTICAL);
for(int i=0; i<16; i++) {
wxString label;
label << "Button " << i;
sizer->Add( new wxButton(panel, wxID_ANY, label), 0, wxALL, 4 );
}
panel->SetScrollRate(10,10);
panel->SetSizer(sizer);
panel->SetAutoLayout(true);
---