Guest User

Marco

a guest
Apr 16th, 2013
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.33 KB | None | 0 0
  1.      
  2. #include <Wt/WApplication>
  3. #include <Wt/WLineEdit>
  4. #include <Wt/WVBoxLayout>
  5. #include <Wt/WHBoxLayout>
  6. #include <Wt/WPushButton>
  7.      
  8.  
  9. using namespace Wt;    
  10.      
  11. class HideShowBug : public WApplication {
  12.    public:
  13.       HideShowBug::HideShowBug (const WEnvironment& env)
  14.       : WApplication(env)
  15.       {
  16.          auto vLayout = new WVBoxLayout(root());
  17.          vLayout->setContentsMargins(0, 0, 0, 0);
  18.      
  19.          WLineEdit *ef1, *ef2;
  20.          WPushButton *btnHide, *btnShow;
  21.  
  22.          vLayout->addWidget(ef1 = new WLineEdit, 0);
  23.          vLayout->addWidget(ef2 = new WLineEdit, 0);
  24.          vLayout->addStretch(1);
  25.  
  26.          ef1->setText("meaow");
  27.          ef2->setText("purr");
  28.  
  29.          auto hLayout = new WHBoxLayout;
  30.          vLayout->addLayout(hLayout, 0, AlignCenter);
  31.  
  32.          hLayout->addWidget(btnHide = new WPushButton("Hide"), 0);
  33.          hLayout->addWidget(btnShow = new WPushButton("Show"), 0);
  34.  
  35.          btnHide->clicked().connect([=] (...) { ef1->hide(); });
  36.          btnShow->clicked().connect([=] (...) { ef1->show(); });
  37.       }
  38.      
  39.       static Wt::WApplication* CreateApplication (const Wt::WEnvironment& env)
  40.       {
  41.          return new HideShowBug(env);
  42.       }
  43. };
  44.      
  45. int main (int argc, char** argv)
  46. {
  47.    return WRun(argc, argv, &HideShowBug::CreateApplication);
  48. }
Advertisement
Add Comment
Please, Sign In to add comment