2012-08-28 21 views
2

我試圖在部分標題欄的末尾添加一個組合框,以便我使用SWT的setTextClient(Control)方法。 我能夠看到部分標題欄中的組件,但這是極端的,但我不希望節標題和標題欄之間有太多的空間。SWT部分setTextClient將複合放到標題欄的末尾

UI- enter image description here

從上圖中,其明確表示AND和OR單選按鈕到底來了,有過濾器標題和標題欄之間的空間。

以下是代碼片段我用來實現各項─

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); 

回答

2

找到了解決辦法, 它實際上與科宣言。

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

和它的工作

+0

然後繼續前進,接受你的答案:) – Baz