TabPanel中的gwt ScrollPanel:没有垂直滚动条 [英] gwt ScrollPanel in TabPanel: no vertical scrollbar
问题描述
编辑
我已经通过调整VerticalPanel
中的组件的大小来修复了空白行为,这些组件似乎对面板尺寸有所影响,但控制台却以某种方式丢失了该影响.我不太明白.
I have fixed the whitespace behaviour by resizing components within the VerticalPanel
, that seem to have had an effect on the panel's dimension somehow missed by the console. I don't quite understand how.
但是,我仍然没有面板显示垂直滚动条.
However, I am still stuck with none of my panels showing vertical scroll bars.
在GWT项目中,我具有以下结构:
In a GWT project, I have the following structure:
页面
DockLayoutPanel
North (header)
Center (body)
South (footer)
/DockLayoutPanel
身体
SplitLayoutPanel$1
West
SplitLayoutPanel$2
North
Center
TabPanel
ScrollPanel
VerticalPanel
-Several widgets-
/VerticalPanel
/ScrollPanel
/TabPanel
/Center
/SplitLayoutPanel$2
/West
Center
/SplitLayoutPanel$1
我的问题出在TabPanel
中的ScrollPanel
,它本身包含一个包含多个小部件的VerticalPanel
.对于TabPanel
中的每个Tab
都是如此.
My problems are with the ScrollPanel
in the TabPanel
, which in itself contains a VerticalPanel
containing several widgets. This is true for each Tab
in the TabPanel
.
我的问题是,虽然SplitLayoutPanel$2
中心的所有容器的宽度都为100%,但是ScrollPanel
包含一个水平滚动条,在VerticalPanel
旁边有一个相当大的白色区域,而它们位于大小相同的绝对指标.
My problem is that, while the width's for all containers in SplitLayoutPanel$2
's center have 100% width, the ScrollPanel
contains a horizontal scrollbar with a considerable white area next to it's VerticalPanel
, while they are in absolute metrics the same size.
说明情况
这是TabPanel
,带有ScrollPanel
和VerticalPanel
.请注意水平滚动条的存在方式,而TabPanel
,ScrollPanel
和VerticalPanel
具有相同的宽度.向右滚动会产生一个白色区域.
This is the TabPanel
, with ScrollPanel
, and VerticalPanel
. Notice how the horizontal scrollbar exists, while the TabPanel
, ScrollPanel
and VerticalPanel
have the same width. Scrolling to the right yields a white area.
ScrollPanel
和VerticalPanel
的绝对宽度均为598px. DockLayoutPanel
的West分量的大小为600,因此可以匹配.另请注意,调出开发人员控制台是如何使滚动条消失的.实际上,整个面板已经消失在其后面,并且没有垂直滚动条弹出.
The ScrollPanel
and VerticalPanel
all sport an absolute width of 598px. The West component of the DockLayoutPanel
has a size of 600, so that matches. Also notice how bringing up the developer console has made the scrollbar disappear. In fact, the entire panel has disappeared behind it, and no vertical scrollbar pops up.
向右滚动条时,VerticalPanel
部分离开屏幕,并且ScrollPanel
显示此空白.显然,我不希望空格出现在其中,因此根本不需要滚动条.在这种情况下,所有面板的宽度均相同:598px.使用右边的边框来调整SplitLayoutPanel
的大小会增加这些值(显然),但是面板确实共享相同的宽度,并且空格保持相同的大小,而我希望它也能变得更宽.
When scrolling the bar to the right, the VerticalPanel
gets partially placed off screen, and the ScrollPanel
shows this whitespace. Obviously, I don't want the whitespace to be there, so there won't be need for a scrollbar at all. All panels in this situation still have the same width: 598px. Resizing the SplitLayoutPanel
, using the border to the right, increases these values (obviously), but the panels do still share equal width and the whitespace remains the same size, while I'd expect it to get wider too.
第二个标签包含大量文本,这些文本继续在屏幕外显示,但没有滚动条出现.
The second tab contains a load of text, which continues off the screen, but no scrollbars appear.
问题结论
- 没有垂直滚动条
- 带有一些神奇召唤空格的水平滚动条
- 组件声称具有相同的宽度
非常感谢您的帮助.
编辑
尝试将VerticalPanel
的大小调整为90%或80%宽度.空白似乎不受影响,它表明100%确实覆盖了可见宽度,而没有更多.
Have tried resizing the VerticalPanel
to 90 or 80% width. The whitespace seems unaffected and it shows that 100% really covers the visible width and not more.
推荐答案
TabPanel
(至少是GWT固有的一种)从内到外调整大小:其大小取决于所选选项卡的大小.因此,除非您明确指定ScrollPanel
的大小,否则您的ScrollPanel
将永远不会有垂直滚动条,并且您的内容实际上溢出了放入TabPanel
的SplitLayoutPanel
的 layer .
TabPanel
(at least the one from GWT proper) resizes from the inside-out: its size varies depending on the size of the selected tab. So your ScrollPanel
will never have a vertical scrollbar unless you explicitly give it a size, and your content is actually overflowing the layer of the SplitLayoutPanel
you put the TabPanel
in.
布局面板(例如TabLayoutPanel
)从外到内调整大小:SplitLayoutPanel
将在其中心区域设置TabLayoutPanel
的大小,而TabLayoutPanel
将依次设置ScrollPanel
的大小,因此,如果ScrollPanel
的内容溢出,则会显示一个垂直滚动条.
Layout panels, such as TabLayoutPanel
, on the other hand resize from the outside-in: the SplitLayoutPanel
would set the size of the TabLayoutPanel
in its center region, and the TabLayoutPanel
would in turn set the size of the ScrollPanel
, so if the content of the ScrollPanel
overflows, a vertical scrollbar appears.
这篇关于TabPanel中的gwt ScrollPanel:没有垂直滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!