- if (sizer)
- {
- sizer->Detach(ctrl);
-
- /*
- +---------+-----------+---------+
- | 0 | label | 1 |
- +---------+-----------+---------+
- | label | ctrl | label |
- +---------+-----------+---------+
- | 2 | label | 3 |
- +---------+-----------+---------+
- */
-
- m_grid = new wxFlexGridSizer(3, 3, m_margin, m_margin);
-
- wxStaticText* l[4];
-
- for (int i = 0; i < 4; ++i)
- l[i] = new wxStaticText(parent, wxID_ANY, wxT(" "));
-
- m_grid->Add(l[0]);
- m_grid->Add(new wxStaticText(parent, wxID_ANY, wxT(" ")));
- m_grid->Add(l[1]);
- m_grid->Add(new wxStaticText(parent, wxID_ANY, wxT(" ")));
- m_grid->Add(ctrl);
- m_grid->Add(new wxStaticText(parent, wxID_ANY, wxT(" ")));
- m_grid->Add(l[2]);
- m_grid->Add(new wxStaticText(parent, wxID_ANY, wxT(" ")));
- m_grid->Add(l[3]);
-
- sizer->Add(m_grid);
- parent->SetSizer(sizer);
- parent->Layout();
-
- parent->Refresh();
- wxYield();
-
- return wxRect(l[0]->GetScreenRect().GetBottomRight(),
- l[3]->GetScreenRect().GetTopLeft());
-
- }
- else // Actually it won't get here working with the current guiframe.h/guiframe.cpp
- {
- return ctrl->GetScreenRect().Inflate(m_margin);
- }
+ //The assertion won't fail if controls are still managed by wxSizer, and it's unlikely to
+ //change in the future.
+ wxASSERT_MSG(sizer,
+ "The GUI that AutoCaptureMechanism working with doesn't manage controls with wxSizer");
+
+ sizer->Detach(ctrl);
+
+ /*
+ +---------+-----------+---------+
+ | 0 | label | 1 |
+ +---------+-----------+---------+
+ | label | ctrl | label |
+ +---------+-----------+---------+
+ | 2 | label | 3 |
+ +---------+-----------+---------+
+ */
+
+ m_grid = new wxFlexGridSizer(3, 3, m_margin, m_margin);
+
+ wxStaticText* l[4];
+
+ for (int i = 0; i < 4; ++i)
+ l[i] = new wxStaticText(parent, wxID_ANY, wxT(" "));
+
+ m_grid->Add(l[0]);
+ m_grid->Add(new wxStaticText(parent, wxID_ANY, wxT(" ")));
+ m_grid->Add(l[1]);
+ m_grid->Add(new wxStaticText(parent, wxID_ANY, wxT(" ")));
+ m_grid->Add(ctrl, 1, wxEXPAND);
+ m_grid->Add(new wxStaticText(parent, wxID_ANY, wxT(" ")));
+ m_grid->Add(l[2]);
+ m_grid->Add(new wxStaticText(parent, wxID_ANY, wxT(" ")));
+ m_grid->Add(l[3]);
+
+ sizer->Add(m_grid);
+ parent->SetSizer(sizer);
+ parent->Layout();
+
+ parent->Refresh();
+ wxYield();
+
+ return wxRect(l[0]->GetScreenRect().GetBottomRight(),
+ l[3]->GetScreenRect().GetTopLeft());