Wednesday, January 4, 2012

Re: Tips on handling ScrollPanel in UiBuilder

Don't give the ScrollPanel an explicit height, as it will get it from the layer. Generally you should be setting the top/height/etc attributes on the <g:layer> rather than on the Widget it contains, this is what happens when you call setWidgetTopHeight etc.  Do give the 'filters' widget an explicit height (as you are already doing) 

  Not really what you asked but, you'll probably want to use top/bottom on the layer, rather than top/height... 
When you call: 
layoutPanel.setWidgetTopHeight(filtersPanel, MENUPANEL_HEIGHT, Unit.PX, 100, Unit.PCT); 

If MENUPANEL_HEIGHT is say,100px, the bottom of filtersPanel will be 100px past the bottom of the layout panel, as setting the height to 100% means 'the height of the entire LayoutPanel.'  

So, instead, set bottom to 0, which will ensure it always 0px from the bottom, regardless of where the top is. 
(Alternatively, you can specify the height of the menu bar in PCT, and set the height of the filterPanels layer to the remaining PCT) 

On Thu, Jan 5, 2012 at 12:16 AM, Thad <thad.humphries@gmail.com> wrote:
I'm trying to figure out how to place a view inside a ScrollPanel so
some on a laptop can use it but someone with a full screen won't be
bothered with scrollbars.

My top level looks like this:

 <g:LayoutPanel>
   <g:layer>
     <g:SimpleLayoutPanel ui:field='menuPanel'>
       <cold:MenuViewImpl ui:field='menu'/>
     </g:SimpleLayoutPanel>
   </g:layer>
   <g:layer>
     <g:ScrollPanel ui:field='filtersPanel' height='600px'>
       <me:FiltersViewImpl ui:field='filters'/>
     </g:ScrollPanel>
   </g:layer>
   ... (more layers)

FiltersViewImpl looks like

 <g:LayoutPanel width='100%' height='580px'
styleName='{style.layoutBorder}'>


When setFiltersLayout() is called, I show it with
layoutPanel.setWidgetTopHeight(filtersPanel, MENUPANEL_HEIGHT,
Unit.PX, 100, Unit.PCT);
and hide the other panels.

I've not hit on the combination that will show the scrollbars on a
smaller screen without alwaysShowScrollBars='true' or reducing the
display area to the detriment of a larger display.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment