PDA

View Full Version : Web browser scrolling



eburgerwa
28 Dec 2010, 12:47 PM
Hi,

I have a page that is longer than the browser window. For some reason the browser does not render vertical scroll bars to allow me to scroll to the bottom of the rendered page?

The GXT code contains a Viewport, with a fair number of nested panels (including tabs). I have set setEnableScroll(true) on the Viewport than contains all the child panels, but still no scroll bars.

Do I have to enable scroll bars programmatically (calculate the size of the rendered panels vs. the browser window) or is there some way I can set the Viewport to take care the rendering of the scroll bars if the browser window is smaller than the rendered content?

Thanks in advance for the advice.

Ersmarker
28 Dec 2010, 2:37 PM
From Viewport javadoc:

LayoutContainer that fills the browser window and monitors window resizing.
Viewports are best used for applications that will fill the browser without
window scrolling. Children of the viewport can allow scrolling.

eburgerwa
28 Dec 2010, 3:40 PM
Ack, my mistake - I should have read that. Thanks for the information.

So, then, all the container are now wrapped by a ContentPanel, with scroll mode set to auto. Still no scroll bars. In the code attached below, ConterPanel contains a number of other containers, including multiple TabPanels.

Thanks again for any advise.



public vod onModuleLoad()
{
TwebViewport viewport = new TwebViewport();
RootPanel rootPanel = RootPanel.get();
rootPanel.add(viewport);
}

public class TwebViewport extends Viewport
{
public TwebViewport()
{
setStylePrimaryName("client");
baseStyle = "client-twebviewport";
// setSize(1000, 1000);
setWidth(1000);


VBoxLayout vbLayout = new VBoxLayout();
vbLayout.setVBoxLayoutAlign(VBoxLayoutAlign.CENTER);
setLayout(vbLayout);

// FitLayout layout = new FitLayout();

ContentPanel masterPanel = new ContentPanel();
masterPanel.setHeaderVisible(false);
masterPanel.setFrame(false);
masterPanel.setCollapsible(false);
masterPanel.setBodyBorder(false);
masterPanel.setScrollMode(Scroll.AUTO);
masterPanel.setWidth(1000);
// masterPanel.setLayout(layout);

// setBorders(true);

// Header
HtmlContainer headerHTML = new HtmlContainer();
String headerURL = GWT.getHostPageBaseURL() + "includes/header.html";
headerHTML.setUrl(headerURL);
masterPanel.add(headerHTML);

// The body
CenterPanel centerPanel = new CenterPanel();
masterPanel.add(centerPanel);

// Footer
HtmlContainer footerHTML = new HtmlContainer();
footerHTML.setBorders(true);
String footerURL = GWT.getHostPageBaseURL() + "includes/footer.html";
footerHTML.setUrl(footerURL);
masterPanel.add(footerHTML);

// Add it to the master panel
add(masterPanel);
}
}

Ersmarker
3 Jan 2011, 12:07 AM
Hi.

To be able to give good advice on what panels and layouts you should use it would be good if you could provide a mockup screenshot of what you want to achive.

eburgerwa
7 Jan 2011, 2:30 PM
To conclude this thread - my questions was answered by this thread that I found after more searching:
http://www.sencha.com/forum/showthread.php?109066-ContentPanel-with-variable-height-depending-on-it-s-content&highlight=scrollcontainer