Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Wt/WApplication>
- #include <Wt/WLineEdit>
- #include <Wt/WVBoxLayout>
- #include <Wt/WHBoxLayout>
- #include <Wt/WPushButton>
- using namespace Wt;
- class HideShowBug : public WApplication {
- public:
- HideShowBug::HideShowBug (const WEnvironment& env)
- : WApplication(env)
- {
- auto vLayout = new WVBoxLayout(root());
- vLayout->setContentsMargins(0, 0, 0, 0);
- WLineEdit *ef1, *ef2;
- WPushButton *btnHide, *btnShow;
- vLayout->addWidget(ef1 = new WLineEdit, 0);
- vLayout->addWidget(ef2 = new WLineEdit, 0);
- vLayout->addStretch(1);
- ef1->setText("meaow");
- ef2->setText("purr");
- auto hLayout = new WHBoxLayout;
- vLayout->addLayout(hLayout, 0, AlignCenter);
- hLayout->addWidget(btnHide = new WPushButton("Hide"), 0);
- hLayout->addWidget(btnShow = new WPushButton("Show"), 0);
- btnHide->clicked().connect([=] (...) { ef1->hide(); });
- btnShow->clicked().connect([=] (...) { ef1->show(); });
- }
- static Wt::WApplication* CreateApplication (const Wt::WEnvironment& env)
- {
- return new HideShowBug(env);
- }
- };
- int main (int argc, char** argv)
- {
- return WRun(argc, argv, &HideShowBug::CreateApplication);
- }
Advertisement
Add Comment
Please, Sign In to add comment