开发者

GWT widget on bottom without knowing height/size

开发者 https://www.devze.com 2023-04-12 22:06 出处:网络
I want to have a two widgets to stack up X Y I want Y to开发者_如何学运维 take up as much height as it needs (its static in size, roughly 50px depending on browser font, etc) and remain affixed to

I want to have a two widgets to stack up

X

Y

I want Y to开发者_如何学运维 take up as much height as it needs (its static in size, roughly 50px depending on browser font, etc) and remain affixed to the bottom of the screen, and X to take the rest of the vertical space.

X happens to be a scrollpanel with VerticalPanel and more inside, Y is a Grid and I've tried putting them in various containers, but they all seem to want a size for Y (ie. DockLayoutPanel & LayoutPanel). If I specify a size for Y it ends up with white space at the bottom on one browser or another. Any advice?


It's just not possible in HTML/CSS. If you absolutely cannot know the height of Y in advance, the way around it would be to:

  • Attach this widget somewhere off-screen
  • Measure it's height using yWidget.getOffsetHeight()
  • Remove it
  • Add it to your LayoutPanel and setting the 'bottom' coordinate to 0 and 'height' to the measured height.
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号