Project

General

Profile

Bug #1014 ยป test_dialog_width.cc

dima s, 10/11/2011 02:10 PM

 
#include <Wt/WApplication>
#include <Wt/WContainerWidget>
#include <Wt/WDialog>
#include <Wt/WPushButton>
#include <Wt/WVBoxLayout>
#include <Wt/WCheckBox>

class HelloApp : public Wt::WApplication
{
public:
HelloApp(const Wt::WEnvironment& env):
Wt::WApplication(env)
{
Wt::WPushButton* btn = new Wt::WPushButton();
btn->setText( "Push" );
btn->clicked().connect( this, &HelloApp::ShowDialog );
root()->addWidget( btn );
}

void ShowDialog()
{
Wt::WDialog dialog( Wt::WString::tr( "Select Columns" ) );
//dialog.setWidth( 200 );
Wt::WContainerWidget* pCont = new Wt::WContainerWidget( dialog.contents() );
Wt::WVBoxLayout* pVLayout = new Wt::WVBoxLayout();
pCont->setLayout( pVLayout );

pVLayout->addWidget( new Wt::WCheckBox( "checkbox1" ) );
pVLayout->addWidget( new Wt::WCheckBox( "checkbox2" ) );

Wt::WPushButton ok( Wt::WString::tr( "Ok" ), dialog.contents() );
Wt::WPushButton cancel( Wt::WString::tr( "Cancel" ), dialog.contents() );
ok.clicked().connect( &dialog, &Wt::WDialog::accept );
cancel.clicked().connect( &dialog, &Wt::WDialog::reject );

if( dialog.exec() == Wt::WDialog::Accepted )
{
}
}
};

Wt::WApplication *createApplication(const Wt::WEnvironment& env)
{
return new HelloApp(env);
}

int main(int argc, char **argv)
{
return Wt::WRun(argc, argv, &createApplication);
}
    (1-1/1)