SWT Section setTextClient将Composite放在标题栏的末尾

时间:2012-08-28 10:50:54

标签: eclipse eclipse-plugin swt rcp

我试图将一个组合框放在Section Title Bar的末尾,这样我就使用了SWT的setTextClient(Control)方法。 我能够在部分标题栏中看到该组件,但这是在极端,但我不希望Section title和TitleBar之间有任何空间。

UI- enter image description here

从上图中可以清楚地看到AND和OR单选按钮到底,并且Filter Title和Title Bar之间有一个空格。

以下是我用来实现同样的代码片段 -

Composite toolbar = toolkit.createComposite(section, SWT.WRAP);
        RowLayout rlayout = new RowLayout(SWT.HORIZONTAL);
        toolbar.setCursor(Display.getDefault().getSystemCursor(SWT.CURSOR_HAND));
        rlayout.marginLeft = 0;
        rlayout.marginRight = 0;
        rlayout.spacing = 0;
        rlayout.marginTop = 0;
        rlayout.marginBottom = 0;
        toolbar.setLayout(rlayout);

        Button A = new Button(toolbar, SWT.RADIO);
        A.setText("AND");

        Button r = new Button(toolbar, SWT.RADIO);
        r.setText("OR");

        section.setTextClient(toolbar);
        section.setText(type.name());
        section.setClient(client);
        section.setExpanded(true);

1 个答案:

答案 0 :(得分:2)

支持解决方案, 实际上是在章节宣言中。

Section section = toolkit.createSection(compositeRightDownContent,
            Section.LEFT_TEXT_CLIENT_ALIGNMENT | Section.COMPACT);

并且有效