Greetings all,
It the course of all my hacking today, I've managed to assemble a test case
that shows some sort of layout rendering bug. Clicking on the "preview"
column in the test case should hide the "editor" and show a second preview
column, suitable for printing. The editor hide()s properly, and the second
preview show()s up, but instead of being on the left side of the browser, they
are on the right. Firebug leads me to believe that the editor is hiding its
content, but still somehow taking up space.
Thanks,
Mike
#include <Wt/WApplication>
#include <Wt/WContainerWidget>
#include <Wt/WBoxLayout>
#include <Wt/WText>
using namespace Wt;
using std::vector;
using std::string;
class testApp : public WApplication
{
public:
testApp(const WEnvironment& env);
private slots:
void viewClicked();
private:
WContainerWidget* makeEditor();
WContainerWidget* makeViewerWidget();
WContainerWidget* makeViewer();
WContainerWidget* makeSpacer();
WContainerWidget* _editor;
WContainerWidget* _spacer;
WContainerWidget* _view2;
};
WApplication *createApplication(const WEnvironment& env)
{
return new testApp(env);
}
int main(int argc, char **argv)
{
return WRun(argc, argv, &createApplication);
}
testApp::testApp(const WEnvironment& env) : WApplication(env)
{
setTitle("WTestCase of Layout Funkiness(tm)");
_editor = makeEditor();
WContainerWidget* view1 = makeViewer();
_spacer = makeSpacer();
_view2 = makeViewer();
WBoxLayout* ltr = new WBoxLayout(Wt::WBoxLayout::LeftToRight);
ltr->addWidget(_editor, 1);
ltr->addWidget(makeViewerWidget());
root()->setLayout(ltr);
_editor->hide();
viewClicked();
}
WContainerWidget* testApp::makeEditor()
{
WContainerWidget* w = new WContainerWidget();
w->decorationStyle().setBorder(WBorder(WBorder::Solid, WBorder::Thin));
new WText("The editor stuff goes here", w);
return w;
}
WContainerWidget* testApp::makeViewerWidget()
{
WContainerWidget* w = new WContainerWidget();
w->decorationStyle().setBorder(WBorder(WBorder::Solid, WBorder::Thin));
WBoxLayout* ltr = new WBoxLayout(WBoxLayout::LeftToRight);
ltr->addWidget(makeViewer());
ltr->addWidget(_spacer = makeSpacer());
ltr->addWidget(_view2 = makeViewer());
w->setLayout(ltr);
w->clicked().connect(SLOT(this, testApp::viewClicked));
return w;
}
void testApp::viewClicked()
{
if(_editor->isHidden()) {
_editor->show();
_spacer->hide();
_view2->hide();
} else {
_editor->hide();
_spacer->show();
_view2->show();
}
}
WContainerWidget* testApp::makeViewer()
{
WContainerWidget* w = new WContainerWidget();
w->decorationStyle().setBorder(WBorder(WBorder::Solid, WBorder::Thin));
w->setMinimumSize(WLength(4, WLength::Inch), WLength(10.5, WLength::Inch));
w->setMaximumSize(WLength(4, WLength::Inch), WLength(10.5, WLength::Inch));
w->setToolTip("Click to toggle editor and multi-column view");
new WText("Preview of data from editor goes here", w);
return w;
}
WContainerWidget* testApp::makeSpacer()
{
WContainerWidget* w = new WContainerWidget();
w->decorationStyle().setBorder(WBorder(WBorder::Solid, WBorder::Thin));
w->setMinimumSize(WLength(.2, WLength::Inch), WLength());
w->setMaximumSize(WLength(.2, WLength::Inch), WLength());
return w;
}
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest