Hey Richard,

2009/7/1 Richard Ulrich <[email protected]>:
> After updating my git working copy (after a while), content that is
> larger than the screen is no longer scrollable.
> Do I have to set some new property to get that back?
> I searched the online documentation and the mailing list, but didn't
> find what I was looking for.

I am not sure what changes may have affected this, but, really, in
general things have improved... (read on!).

> Here is a stripped down example to demonstrate the problem:
>
> /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8/////////9/////////A
> class Testapp_Scroll : public Wt::WApplication
> {
> public:
>        Testapp_Scroll(const Wt::WEnvironment& env) : Wt::WApplication(env)
>        {
>            Wt::WBorderLayout *blayout = new Wt::WBorderLayout();
>                root()->setLayout(blayout);
>
>        Wt::WTabWidget *tabw = new Wt::WTabWidget();
>        blayout->addWidget(tabw, Wt::WBorderLayout::Center);
>
>        Wt::WContainerWidget *tab1 = new Wt::WContainerWidget();
>        tabw->addTab(tab1, "Tab1");

// here set the tab height to 100%. In this way, the layout manager will know
// how to constrain its height.

// if you are not using a layout manager, you will also want to set its overflow
// property so that scrollbars appear.
tab1->resize(Wt::WLength::Auto, Wt::WLength(100, Wt::WLength::Percentage));

>        Wt::WBorderLayout *blayout1 = new Wt::WBorderLayout();
>        tab1->setLayout(blayout1);
>        Wt::WTable *table1 = new Wt::WTable();

// a WTable is a bit of a bad behaving widget: its vertical size
cannot be constrained,
// it will always grow to whatever size it needs to be. Therefore,
wrap it in in a container:

       Wt::WContainerWidget *w = new Wt::WContainerWidget();
       w->setOverflow(Wt::WContainerWidget::OverflowAuto);
       w->addWidget(table1)

- blayout1->addWidget(table1, Wt::WBorderLayout::Center);
+ blayout1->addWidget(w, Wt::WBorderLayout::Center);

>        for(int i=0; i<200; ++i)
>        {
>            Wt::WText *txt = new
> Wt::WText(boost::lexical_cast<std::string>(i));
>            table1->elementAt(i, 0)->addWidget(txt);
>        }
>        }
> };
> /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8/////////9/////////A
> Wt::WApplication *createApplication(const Wt::WEnvironment& env)
> {
>        Testapp_Scroll *app = new Testapp_Scroll(env);
>
>        return app;
> }
> /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8/////////9/////////A
> int main(int argc, char *argv[])
> {
>        return Wt::WRun(argc, argv, &createApplication);
> }
> /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8/////////9/////////A
>

With these changes, your example runs fine for me.

I am updating the documentation to point out these usage caveats of
using WTabWidget and layout-managers + WTable widgets.

Regards,
koen

------------------------------------------------------------------------------
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to