Krishnaveni
Krishnaveni

Reputation: 809

Add scroll bar to Composite which uses GridLayout

I want to add vertical scroll bar to the screen that comes out of the below code. can you please suggest how it can be done?

public class SampleDialog extends TrayDialog {

public SampleDialog(final Shell shell) {
    super(shell);
    this.shell = shell;

}


@Override
public void create() {
    super.create();

}

@Override
protected Control SampleDialog(final Composite parent) {
    final GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    parent.setLayout(layout);

    createSampleText(parent);

    createSampleCombo(parent);
}
} 

where:
org.eclipse.jface.dialogs.TrayDialog;
org.eclipse.swt.layout.GridLayout;

org.eclipse.swt.widgets.Composite;

Upvotes: 2

Views: 5658

Answers (1)

Waqas Ilyas
Waqas Ilyas

Reputation: 3241

You can use a ScrolledComposite as the main parent for all your child controls in the dialog.

Some helpful snippets can be found here.

Upvotes: 5

Related Questions