Thursday, January 5, 2012

Re: Tips on handling ScrollPanel in UiBuilder

Excellent. That works and is exactly what I was trying to achieve.
Thank you, Aidan.

Here's a follow-up question: When using UiBuilder, how do I implement
a panel's onResize() method? I think the answer is to assign the
panels' ui:field's in FiltersViewImpl.ui.xml and call their onResize()
in my FiltersViewImpl.java. Am I correct?

Going back to my original question, I remove height from g:ScrollPanel
in FiltersViewImpl.ui.xml. In what had been:

layoutPanel.setWidgetTopHeight(menuPanel, 0, Unit.PX,
MENUPANEL_HEIGHT, Unit.PX);
layoutPanel.setWidgetTopHeight(filtersPanel, MENUPANEL_HEIGHT,
Unit.PX, 100, Unit.PCT);
...

in MyAppViewImpl is now:

layoutPanel.setWidgetTopHeight(menuPanel, 0, Unit.PX,
MENUPANEL_HEIGHT, Unit.PX);
layoutPanel.setWidgetTopBottom(filtersPanel, MENUPANEL_HEIGHT,
Unit.PX, 0, Unit.PX);
...


(Sigh... XmForms, GridBagLayout, and now this. Makes me long for the
days when everyone had one of 3 displays and I could just draw a GUI
in ResEdit.)

On Jan 4, 7:54 pm, "Aidan O'Kelly" <aida...@gmail.com> wrote:
> 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.humphr...@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