Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Your design is fairly complicated. I don't use wxFormbuilder, I like to set up my form manually, by "hard coding" the layout.</p> <p>So before I explain how I would do it, here's a few advice: </p> <ul> <li>I would put the ok/cancel/help bar somewhere else (in a separate wxPanel, and put them together in the dialog at the end)</li> <li>I would move the test connect button on the ok/cancel/help bar. </li> <li>The test connect button is in an awful place at the moment in term of setting the layout</li> <li>(optionally) I would split the form between name/host/database and username/password since they represent some sub unit you can reuse somewhere else</li> </ul> <p>Now here is how I would build the form. I let you implement the getValue and setValue. Also you'll need to do something similar for the tool bar (using a <code>wxBoxSizer</code>) and put them together (using a <code>wxBoxSizer</code> again).</p> <p>Also if you may want to use a <code>wxStaticBox</code></p> <pre><code>class ConnectionEditor : wxPanel { public: ConnectionEditor(wxWindow* parent); // void getValue(ConnectionSettings&amp;); void setValue(ConnectionSettings const&amp;); private: wxTextCtrl* name_; wxTextCtrl* host_; wxTextCtrl* database_; wxTextCtrl* username_; wxTextCtrl* password_; wxCheckBox* save_password_; }; wxTextCtrl* CreateTextControl(wxWindow* parent) { return new wxTextCtrl(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(100, 20)); } wxTextCtrl* CreateStaticText(wxWindow* parent, std::string const&amp; text) { return new wxStaticText(parent, wxID_ANY, text.c_str()); } ConnectionEditor::ConnectionEditor(wxWindow* parent) : wxPanel(parent, wxID_ANY) { this-&gt;name_ = CreateTextControl(this); this-&gt;host_ = CreateTextControl(this); this-&gt;database_ = CreateTextControl(this); this-&gt;username_ = CreateTextControl(this); this-&gt;password_ = CreateTextControl(this); this-&gt;save_password_ = new wxCheckBox(this, wxID_ANY, "on"); // wxFlexGridSizer* sizer = new wxFlexGridSizer(6, 2, 5, ,5); // 6 rows, 2 cols, 5 spacing in between // sizer-&gt;Add(CreateStaticText(this, "Name")); sizer-&gt;Add(this-&gt;name_); sizer-&gt;Add(CreateStaticText(this, "Host")); sizer-&gt;Add(this-&gt;host_); sizer-&gt;Add(CreateStaticText(this, "Database")); sizer-&gt;Add(this-&gt;database_); sizer-&gt;Add(CreateStaticText(this, "Username")); sizer-&gt;Add(this-&gt;username_); sizer-&gt;Add(CreateStaticText(this, "Password")); sizer-&gt;Add(this-&gt;password_); sizer-&gt;Add(CreateStaticText(this, "Save Password")); sizer-&gt;Add(this-&gt;save_password_); // this-&gt;SetSizerAndFit(sizer); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload