Horizontal scrolling
Added by Anonymous almost 15 years ago
Hi All,
I can't seem to get horizontal scrolling working. My actual case is involved a WHBoxLayout with a resize handle between two child widgets where the two child widgets are WScrollAreas. The behavior I see is that the vertical scroll bar behaves as expected, but the horizontal scrollbar never functions - it seems that the WScrollArea does not want to shrink past the width of it's child, which leads to clipping.
I found a simple case where I see this behavior without the use of the resize handle - I assume that fixing this case will fix my other problem. Consider the following:
Wt::WApplication *app = new WApplication( env );
// use a VBox layout so that the app stretches to fill the window
Wt::WVBoxLayout *topLevelLayout = new Wt::WVBoxLayout();
app->root()->setLayout( topLevelLayout );
Wt::WScrollArea* s = new Wt::WScrollArea( app->root() );
s->setScrollBarPolicy( Wt::WScrollArea::ScrollBarAlwaysOn );
topLevelLayout->addWidget( s );
s->setWidget( new Wt::WLabel( "long text across <br /> multiple lines" ) );
Note: Set the label text to be something that is long and has many lines.
With both IE8 and Chrome, the horizontal scroll bar does not do any scrolling. Rather, the text gets clipped when the browser window in made narrow. It works well in the vertical direction.
Any thoughts on how to get the desired scrolling behavior?
I am using WT 3.1.4 with Visual Studio 2008.
Cheers,
Dan
Replies (3)
RE: Horizontal scrolling - Added by Koen Deforche almost 15 years ago
Hey Dan,
This has been fixed in git now for cases where you use a WScrollArea directly inside a container widget.
Regards,
koen
RE: Horizontal scrolling - Added by Anonymous almost 15 years ago
Thanks Koen - I look forward to this being in the next release.
I've observed the same behavior using a WContainterWidget inside a WContainerWidget with overflow set to OverflowAuto. I assume the fix you've done will also cover that case? If you're not sure, I could try to make a test case for you.
Cheers,
Dan
RE: Horizontal scrolling - Added by Koen Deforche almost 15 years ago
Hey Daniel,
My previous message should read "... where you use a WScrollArea directly inside a layout manager" instead o "... in a container widget."
The case (WContainerWidget inside WContainerWidget inside layout manager) isn't covered however. I did consider solving this case too, but, the trick used can only work when only one widget is added inside the WContainerWidget with OverflowAuto, and unlike a WScrollArea, a container widget allows multiple children.
I have added a big fat warning to setOverflow() however.
Regards,
koen