{"id":3899,"date":"2021-12-18T08:25:59","date_gmt":"2021-12-18T08:25:59","guid":{"rendered":"http:\/\/truelogic.org\/wordpress\/?p=3899"},"modified":"2021-12-18T08:26:01","modified_gmt":"2021-12-18T08:26:01","slug":"5b-2-wxwidgets-wxstaticboxsizer","status":"publish","type":"post","link":"https:\/\/truelogic.org\/wordpress\/2021\/12\/18\/5b-2-wxwidgets-wxstaticboxsizer\/","title":{"rendered":"5b-2. wxWidgets &#8211; wxStaticBoxSizer"},"content":{"rendered":"\n<p><strong>OVERVIEW<\/strong><\/p>\n\n\n\n<p>wxStaticBoxSizer is the same as wxBoxSizer except it draws a border around the controls contained within it. This is good for grouping controls visually.<\/p>\n\n\n\n<p><strong>SAMPLE CODE<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">wxstaticboxsizer.h<\/pre>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\n#include &lt;wx\/wxprec.h&gt;\n#ifndef WX_PRECOMP\n\t#include &lt;wx\/wx.h&gt;\n#endif\n\nclass StaticBoxSizer: public wxFrame {\n\tpublic:\n\t\tStaticBoxSizer(const wxString &amp;title);\t\n};\n<\/pre><\/div>\n\n\n<pre class=\"wp-block-preformatted\">wxstaticboxsizer.cpp<\/pre>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\n#include &quot;wxstaticboxsizer.h&quot;\n\nStaticBoxSizer::StaticBoxSizer(const wxString &amp;title):\n\twxFrame(NULL, -1, title, wxDefaultPosition, wxSize(500,250)) {\n\n\twxPanel *basePanel = new wxPanel(this,-1);\n\twxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL);\n\tbasePanel-&gt;SetSizer(vbox);\n\n\twxPanel *panel1 = new wxPanel(basePanel, -1);     \n\twxButton *btn1 = new wxButton(panel1, -1, wxT(&quot;Button 1&quot;));\n\twxButton *btn2 = new wxButton(panel1, -1, wxT(&quot;Button 2&quot;));\n\twxButton *btn3 = new wxButton(panel1, -1, wxT(&quot;Button 3&quot;));\n\n\twxStaticBoxSizer *hbox = new wxStaticBoxSizer(wxHORIZONTAL, panel1);\n\thbox-&gt;Add(btn1, 1, wxALL, 10);\n\thbox-&gt;Add(btn2,1, wxALL, 10);\n\thbox-&gt;Add(btn3,1, wxALL, 10);\n\tpanel1-&gt;SetSizer(hbox);\n\tvbox-&gt;Add(panel1, 0, wxALIGN_CENTER);\n\n\tCenter();\n}\n<\/pre><\/div>\n\n\n<pre class=\"wp-block-preformatted\">main.h<\/pre>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\n#include &lt;wx\/wxprec.h&gt;\n#ifndef WX_PRECOMP\n\t#include &lt;wx\/wx.h&gt;\n#endif\n\nclass Main: public wxApp {\n\n\tpublic:\n\t\tvirtual bool OnInit();\n};\n<\/pre><\/div>\n\n\n<pre class=\"wp-block-preformatted\">main.cpp<\/pre>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\n#include &quot;main.h&quot;\n#include &quot;wxstaticboxsizer.h&quot;\n\nIMPLEMENT_APP(Main)\n\nbool Main::OnInit() {\n\tStaticBoxSizer *app = new StaticBoxSizer(wxT(&quot;Static Box Sizer&quot;));\n\tapp-&gt;Show(true);\n\n}\n\n<\/pre><\/div>\n\n\n<p>The output is shown below<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"500\" height=\"250\" src=\"https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2021\/12\/Screenshot-from-2021-12-18-13-54-39.png\" alt=\"\" class=\"wp-image-3901\" srcset=\"https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2021\/12\/Screenshot-from-2021-12-18-13-54-39.png 500w, https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2021\/12\/Screenshot-from-2021-12-18-13-54-39-300x150.png 300w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>OVERVIEW wxStaticBoxSizer is the same as wxBoxSizer except it draws a border around the controls contained within it. This is good for grouping controls visually. <a class=\"mh-excerpt-more\" href=\"https:\/\/truelogic.org\/wordpress\/2021\/12\/18\/5b-2-wxwidgets-wxstaticboxsizer\/\" title=\"5b-2. wxWidgets &#8211; wxStaticBoxSizer\">[&#8230;]<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":3595,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[302,365],"tags":[],"class_list":["post-3899","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cc","category-wxwidgets"],"_links":{"self":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts\/3899","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/comments?post=3899"}],"version-history":[{"count":2,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts\/3899\/revisions"}],"predecessor-version":[{"id":3902,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts\/3899\/revisions\/3902"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/media\/3595"}],"wp:attachment":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/media?parent=3899"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/categories?post=3899"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/tags?post=3899"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}