#include <iostream>
#include <boost/lexical_cast.hpp>
#include <WApplication>
#include <WContainerWidget>
#include <WText>
#include <WEvent>
#include <WStandardItemModel>
#include <WDate>
#include <Ext/TableView>
#include <Ext/ToolBar>
#include <Ext/Button>
#include <Ext/CheckBox>
#include <Ext/DateField>
using namespace Wt;
class Test : public WApplication {
public:
Test(const WEnvironment& env);
private:
WStandardItemModel *model;
WString dForm;
void cerr();
};
Test::Test(const WEnvironment& env)
: button(),
WApplication(env) {
WContainerWidget *ex = new WContainerWidget(root());
model = new WStandardItemModel(1, 2, this);
model->setHeaderData(0, Horizontal, boost::any(WString("who")));
model->setHeaderData(1, Horizontal, boost::any(WString("time")));
Ext::TableView *tv = new Ext::TableView(ex);
tv->resize(WLength(500), WLength(200));
tv->setModel(model);
dForm = WString("yyyy-MM-dd");
Ext::DateField *time_ = new Ext::DateField();
time_->setFormat(dForm);
std::string renderer_ = Ext::TableView::dateRenderer(dForm);
tv->setEditor(1, time_);
tv->setRenderer(1, renderer_);
model->setData(0, 0, boost::any(WString("tester")));
model->setData(0, 1, boost::any(WDate(2008,8,8)));
Ext::Button *b = new Ext::Button("print to browser title", ex);
b->clicked.connect(SLOT(this, Test::cerr));
}
void Test::cerr() {
// the date will be null when using IE, but FF is ok
setTitle(boost::any_cast<WDate>(model->data(0, 1)).toString(dForm));
}
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest