How to resize a scroll composite to always fit its contents horizontally?

倾然丶 夕夏残阳落幕 提交于 2019-12-12 15:02:07

问题


I have a scrolled composite ,it contains a tableViewer. My requirement is that if the table is increased in width,the scroll composite should not show horizontal scroll ,but it should expand to fit table's size. The only reason I have used a scrolled composite here is I want to show vertical scroll bar.


回答1:


If you want to control the scrollbars of a Table in SWT - which is a sub-class of Scrollable - simply add one or more of the following styles in the constructor. If you construct a Viewer, the same styles are used.

SWT.H_SCROLL

Style constant for horizontal scrollbar behavior

SWT.V_SCROLL

Style constant for vertical scrollbar behavior

SWT.NO_SCROLL

Style constant for no scrollbar behavior

When neither H_SCROLL or V_SCROLL are specified, controls are free to create the default scroll bars for the control. Using NO_SCROLL overrides the default and forces the control to have no scroll bars.



来源:https://stackoverflow.com/questions/7749802/how-to-resize-a-scroll-composite-to-always-fit-its-contents-horizontally

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!