The following program tries to display 2 WText widgets, one at the top of the
browser window, one at the bottom. I use a WVBoxLayout and addStretch to try and
achieve this.

The intended result is that "top_line" is displayed at the top of the browser
window, and "bottom_line" is displayed at the bottom.

The actual result is that "top_line is displayed at the top of the browser
window, and bottom line is displayed immediately below "top_line".

Is there a way to place a stretchable area between 2 widgets arranged 
vertically?

Using Wt 3.1.9 and Firefox 4.0.1

-Dave

#include <Wt/WApplication>
#include <Wt/WEnvironment>
#include <Wt/WStackedWidget>
#include <Wt/WText>
#include <Wt/WVBoxLayout>

#include <Wt/WApplication>

class FooApplication : public Wt::WApplication
{
private:
  const Wt::WEnvironment& env_;

  Wt::WStackedWidget *topLevelStack_;
public:
  FooApplication(const Wt::WEnvironment& env);
};

FooApplication::FooApplication(const Wt::WEnvironment& env) : WApplication(env),
env_(env) {
  useStyleSheet("https://www.memorial-anesthesia.org/everywidget.css";);

  this->setInternalPath("Foo");

  topLevelStack_=new Wt::WStackedWidget(this->root());
  topLevelStack_->setOverflow(Wt::WStackedWidget::OverflowAuto);
  topLevelStack_->setPositionScheme(Wt::Relative);
  topLevelStack_->setStyleClass("contents");
  topLevelStack_->setContentAlignment(Wt::AlignTop);

  Wt::WContainerWidget *problemWContainerWidget=new Wt::WContainerWidget();
  problemWContainerWidget->resize(Wt::WLength::Auto, 1000);
          Wt::WVBoxLayout *problemWVBoxLayout=new Wt::WVBoxLayout;
                problemWVBoxLayout->addWidget(new 
Wt::WText("top_line"),0,Wt::AlignTop);
                problemWVBoxLayout->addStretch(1);         
                problemWVBoxLayout->addWidget(new 
Wt::WText("bottom_line"),0,Wt::AlignTop);

          problemWContainerWidget->setLayout(problemWVBoxLayout, Wt::AlignTop);
  topLevelStack_->addWidget(problemWContainerWidget);
}

Wt::WApplication *createApplication(const Wt::WEnvironment& env)
{
  Wt::WApplication *app = new FooApplication(env);

  return app;
}

/*
./WebSchedule --http-address 127.0.0.1 --http-port 8080 --docroot .
 */

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




------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to