Abhishek Choudhary
Abhishek Choudhary

Reputation: 8395

SWT Section setTextClient Putting the Composite in the End of the Title Bar

I am trying to put a Combo Box in the End of Section Title Bar , so that I used setTextClient(Control) method of SWT. I am able to see the component in the section title bar but that is in the extreme end but I don't want any much space between Section title and TitleBar.

UI- enter image description here

From the figure above, its clear that AND and OR radio buttons are coming in the end and there is a space between Filter Title and Title Bar.

Following is the code snippet I used to achieve the same-

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

Upvotes: 2

Views: 795

Answers (1)

Abhishek Choudhary
Abhishek Choudhary

Reputation: 8395

FOund the solution, It was actually with the Section Declaration.

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

and it worked

Upvotes: 2

Related Questions