Hey Josehp,
2010/1/5 Joseph VanAndel <[email protected]>:
> Thanks for the suggestion.
>
> I recompiled my demo program with Wt 3.1 with your change. The yellow box is
> larger, but the TextArea box (PPI1 completed) is still displayed right in the
> middle of the 'Schedule' tab.
That is because you have also specified a height for a container (400
px), which is overflowed by its contents. The version in attachment
works for me, but I am not entirely sure what result you are looking
for ?
> (Can you easily view the PNG screendumps, or would you prefer JPEG or PDF?)
The PNG screendumps make it fine on the mailing list !
Regards,
koen
/*
* Copyright (C) 2006 Wim Dumon, Koen Deforche
*
* See the LICENSE file for terms of use.
*/
#include <iostream>
#include <vector>
#include <string>
#include <boost/format.hpp>
#include <Wt/WApplication>
#include <Wt/WBreak>
#include <Wt/WContainerWidget>
#include <Wt/WDialog>
#include <Wt/WLineEdit>
#include <Wt/WPushButton>
#include <Wt/WText>
#include <Wt/WGridLayout>
#include <Wt/WRadioButton>
#include <Wt/WButtonGroup>
#include <Wt/WTextArea>
#include <Wt/WHBoxLayout>
#include <Wt/WVBoxLayout>
#include <Wt/WTabWidget>
#include <Wt/WSignalMapper>
typedef std::vector<Wt::WText*> WTextVector;
#define MAX_PPIS 10
// This may look like C code, but it's really -*- C++ -*-
/*
* Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
*
* See the LICENSE file for terms of use.
*/
#include <Wt/WText>
using namespace Wt;
#include <iostream>
#include <boost/lexical_cast.hpp>
class Schedule_UI : public Wt::WObject
{
public:
Schedule_UI() { }
Wt::WContainerWidget *ShowWindow();
private:
Wt::WVBoxLayout *ppiLayout_;
WTextVector wTextVector_;
};
using namespace Wt;
WText *createDragName(char *name, const char *mimeType, WLayout *layout)
{
WText *result = new WText(name);
WText *drag = new WText(name);
layout->addWidget(result);
layout->addWidget(drag);
result->setDraggable(mimeType, drag, true);
// result->setInline(false);
return result;
}
WContainerWidget *Schedule_UI::ShowWindow()
{
WContainerWidget *container = new WContainerWidget(NULL);
//container->resize(WLength(), 400);
container->setStyleClass("yellow-box");
WHBoxLayout *contentsLayout = new WHBoxLayout(container);
ppiLayout_ = new WVBoxLayout();
contentsLayout->addLayout(ppiLayout_, 1, Wt::AlignLeft | Wt::AlignTop);
WText *title = new WText("PPI");
ppiLayout_->addWidget(title);
for (unsigned int i = 0; i < MAX_PPIS; ++i) {
char buffer[15];
sprintf(buffer, "ppi%02d", i);
wTextVector_.push_back( createDragName(buffer, "ppi", ppiLayout_));
}
return container;
}
/*
* test application using tabs inside a dialog
*/
class TabDemo : public WApplication
{
public:
TabDemo(const WEnvironment& env);
// bool readConfiguration(std::string filename);
~TabDemo();
private:
WGridLayout *ppiGrid_;
WGridLayout *rhiGrid_;
WGridLayout *surGrid_;
WHBoxLayout *hbox1_;
WHBoxLayout *hbox2_;
WVBoxLayout *vbox1_;
WContainerWidget *outer_;
WContainerWidget *scanCW_;
WContainerWidget *hbox2CW_;
WContainerWidget *ppiContainer_;
WContainerWidget *rhiContainer_;
WContainerWidget *surContainer_;
WLineEdit *nameEdit_;
WButtonGroup *ppiButtonGroup_;
WButtonGroup *rhiButtonGroup_;
WButtonGroup *surButtonGroup_;
WText *showTip_;
WContainerWidget *ShowTab(char *title);
WContainerWidget *showLog(WContainerWidget *parent=0);
void ShowDialog();
};
/*
* The env argument contains information about the new session, and
* the initial request. It must be passed to the WApplication
* constructor so it is typically also an argument for your custom
* application constructor.
*/
TabDemo::TabDemo(const WEnvironment& env) :
WApplication(env)
{
setTitle("Tab Demo Test "); // application title
outer_ = new WContainerWidget(root());
WTabWidget *tw = new WTabWidget(AlignTop | AlignJustify, outer_);
tw->setStyleClass("tabwidget");
tw->addTab(ShowTab("Equal Angles"), "Equal Angles", WTabWidget::PreLoading);
tw->addTab(ShowTab("Equal Resolution"), "Equal Resolution", WTabWidget::PreLoading);
tw->addTab(ShowTab("Rotate"), "Rotate", WTabWidget::PreLoading);
Schedule_UI *sched = new Schedule_UI();
tw->addTab(sched->ShowWindow(), "Schedule", WTabWidget::PreLoading);
outer_->addWidget(showLog());
}
void TabDemo::ShowDialog()
{
WDialog dialog;
dialog.setWindowTitle("Dialog Tab Test");
WVBoxLayout *contentsLayout = new WVBoxLayout();
dialog.contents()->setLayout(contentsLayout);
dialog.contents()->resize(WLength(), 500);
if ( dialog.exec() == WDialog::Accepted) {
std::cerr << "dialog accepted\n";
}
}
WContainerWidget *TabDemo::showLog(WContainerWidget *parent)
{
WContainerWidget *logContainer = new WContainerWidget(parent);
WTextArea *log = new WTextArea(logContainer);
log->setColumns(80);
log->setRows(10);
log->setText("PPI1 completed at 10:30:10, 2009/06/25\nSUR2 completed at 10:41:20, 2009/06/25\n");
// log->setText("SUR2 completed at 10:41:20, 2009/06/25\n");
return logContainer;
}
TabDemo::~TabDemo()
{
}
WContainerWidget *TabDemo::ShowTab(char *title)
{
WContainerWidget *container = new WContainerWidget(NULL);
container->resize(WLength(), 400);
WVBoxLayout *contentsLayout = new WVBoxLayout(container);
WGridLayout *grid = new WGridLayout();
contentsLayout->addLayout(grid,1, Wt::AlignTop);
WText *titlew = new WText(title);
grid->addWidget(titlew, 0, 2, 1, 2);
return container;
}
WApplication *createApplication(const WEnvironment& env)
{
/*
* You could read information from the environment to decide whether
* the user has permission to start a new application
*/
TabDemo *r = new TabDemo(env);
//r->useStyleSheet("everywidget.css");
// r->readConfiguration("/tmp/radar_ctl.txt");
return r;
}
int main(int argc, char **argv)
{
/*
* Your main method may set up some shared resources, but should then
* start the server application (FastCGI or httpd) that starts listening
* for requests, and handles all of the application life cycles.
*
* The last argument to WRun specifies the function that will instantiate
* new application objects. That function is executed when a new user surfs
* to the Wt application, and after the library has negotiated browser
* support. The function should return a newly instantiated application
* object.
*/
return WRun(argc, argv, &createApplication);
}
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest