我希望ScrolledComposite有一个父母有一个GridLayout但滚动条没有显示,除非我使用FillLayout.我的问题FillLayout是它的孩子占用了可用空间的相等部分.
在我的情况下,有两个小部件,顶部的一个小部件应该占不到窗口的1/4,并且ScrolledComposite应该占用剩余空间.但是,它们都占了一半.
有没有办法使用GridLayoutwith ScrolledComposite或是否可以修改行为FillLayout?
这是我的代码:
private void initContent() {
//GridLayout shellLayout = new GridLayout();
//shellLayout.numColumns = 1;
//shellLayout.verticalSpacing = 10;
//shell.setLayout(shellLayout);
shell.setLayout(new FillLayout(SWT.VERTICAL));
searchComposite = new SearchComposite(shell, SWT.NONE);
searchComposite.getSearchButton().addListener(SWT.Selection, this);
ScrolledComposite scroll = new ScrolledComposite(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
scroll.setLayout(new GridLayout(1, true));
Composite scrollContent = new Composite(scroll, SWT.NONE);
scrollContent.setLayout(new GridLayout(1, true));
for (ChangeDescription description : getChanges(false)) {
ChangesComposite cc = new ChangesComposite(scrollContent, description);
} …Run Code Online (Sandbox Code Playgroud) 我是JavaScript和Greasemonkey的noob,我想写一个简单的脚本.
我知道Greasemonkey用一个匿名函数包装你的代码,所以你的变量在离开当前页面后将不存在.但是,我需要一个全局变量.我试图使用unsafeWindow和window对象,如下所示:
if (window.myVar == undefined) {
window.myVar = "myVar";
}
Run Code Online (Sandbox Code Playgroud)
如果我刷新页面,则条件的值始终为true.
有没有办法在Greasemonkey中使用全局变量?