Added by Peter-Frank Spierenburg about 9 years ago
Here is the constructor for a very simple WApplication subclass.
Application::Application(const Wt::WEnvironment& env) : WApplication(env)
{
Wt::WHBoxLayout* rootLayout = new Wt::WHBoxLayout();
root()->setLayout(rootLayout);
Wt::WPanel *lp = new Wt::WPanel();
lp->setCentralWidget(new Wt::WText("This panel is larger."));
rootLayout->addWidget(lp);
Wt::WPanel *rp = new Wt::WPanel();
rootLayout->addWidget(rp);
}
Can someone explain what I need to do to this code to make the lp and rp Wt::WPanels the same size?
Hey,
I believe you need to set a preferred size for the WPanels, e.g.
lp->setWidth("50%");
rp->setWidth("50%");
In addition, you may want to place the WText in a WScrollArea, so that the contents will scroll if needed. See: http://www.webtoolkit.eu/wt/doc/reference/html/classWt_1_1WBoxLayout.html#details.