StaticBoxSizers

Hi!

It's my very first time using wxWidgets (with C++, not Python, but I'm
assuming it's almost the same?)

I'm having a lot of trouble adding panning controls with the following
bits of code:

BoxSizer1 = new wxBoxSizer(wxHORIZONTAL);
Panel1 = new wxPanel(this, ID_PANEL1, wxDefaultPosition,
wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL1"));
// Panning controls
wxStaticBoxSizer* panningContourSizer = new
wxStaticBoxSizer(wxHORIZONTAL,Panel1,wxT("Panning"));
wxGridSizer* panningButtonsSizer = new wxGridSizer(2, 3, 3, 3);
panningButtonsSizer->Add(new wxBitmapButton(this, ID_PAN_UP,
wxBitmap(wxT("up"))));
panningButtonsSizer->Add(new wxBitmapButton(this, ID_PAN_LEFT,
wxBitmap(wxT("left"))));
panningButtonsSizer->Add(new wxBitmapButton(this, ID_PAN_DOWN,
wxBitmap(wxT("down"))));
panningButtonsSizer->Add(new wxBitmapButton(this, ID_PAN_RIGHT,
wxBitmap(wxT("right"))));
panningContourSizer->Add(panningButtonsSizer, 0, wxALL, 5);

StaticBoxSizer3 = new wxStaticBoxSizer(wxHORIZONTAL, Panel1,
_("Map"));
StaticBoxSizer3->Add(panningContourSizer);
// BoxSizer1->Add(panningContourSizer);

So, if I add the panningContourSizer to StaticBoxSizer3, the buttons
are displayed in the exact position I need them to be (top right where
panning buttons usually are anyways). However, none of the button
clicks register! When I add panningContourSizer to BoxSizer1, however,
although it's in a weird position on screen, I can click on the
buttons, and the corresponding panning consequently takes place.
Does placing a StaticBoxSizer into another StaticBoxSizer simply
swallow up keyboard clicks or any other events? Is there any way I can
keep the buttons in StaticBoxSizer3 and have them act like buttons
(and not just arrow images that don't do anything)?

Thank you in advance.

Hi,

ยทยทยท

On Tue, Mar 9, 2010 at 3:59 PM, Sev <sevantess6@gmail.com> wrote:

Hi!

It's my very first time using wxWidgets (with C++, not Python, but I'm
assuming it's almost the same?)

I'm having a lot of trouble adding panning controls with the following
bits of code:

BoxSizer1 = new wxBoxSizer(wxHORIZONTAL);
Panel1 = new wxPanel(this, ID_PANEL1, wxDefaultPosition,
wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL1"));
// Panning controls
wxStaticBoxSizer* panningContourSizer = new
wxStaticBoxSizer(wxHORIZONTAL,Panel1,wxT("Panning"));
wxGridSizer* panningButtonsSizer = new wxGridSizer(2, 3, 3, 3);
panningButtonsSizer->Add(new wxBitmapButton(this, ID_PAN_UP,
wxBitmap(wxT("up"))));
panningButtonsSizer->Add(new wxBitmapButton(this, ID_PAN_LEFT,
wxBitmap(wxT("left"))));
panningButtonsSizer->Add(new wxBitmapButton(this, ID_PAN_DOWN,
wxBitmap(wxT("down"))));
panningButtonsSizer->Add(new wxBitmapButton(this, ID_PAN_RIGHT,
wxBitmap(wxT("right"))));
panningContourSizer->Add(panningButtonsSizer, 0, wxALL, 5);

StaticBoxSizer3 = new wxStaticBoxSizer(wxHORIZONTAL, Panel1,
_("Map"));
StaticBoxSizer3->Add(panningContourSizer);
// BoxSizer1->Add(panningContourSizer);

So, if I add the panningContourSizer to StaticBoxSizer3, the buttons
are displayed in the exact position I need them to be (top right where
panning buttons usually are anyways). However, none of the button
clicks register! When I add panningContourSizer to BoxSizer1, however,
although it's in a weird position on screen, I can click on the
buttons, and the corresponding panning consequently takes place.
Does placing a StaticBoxSizer into another StaticBoxSizer simply
swallow up keyboard clicks or any other events? Is there any way I can
keep the buttons in StaticBoxSizer3 and have them act like buttons
(and not just arrow images that don't do anything)?

You need to create the StaticBox(es) before any of the controls that
they will contain otherwise they will not get mouse clicks and other
events.

If you have questions about wxWidgets, there is another mailing list
for that: http://groups.google.com/group/wx-users?lnk=

Cody