Reputation: 567
How can I change the Text control style with SWT.MULTI
I tried overriding the method but still the same
@Override
protected int getInputTextStyle() {
return SWT.MULTI | SWT.BORDER;
}
Upvotes: 1
Views: 716
Reputation: 111217
You need to change the layout on the dialog's text control to set a suggested height. To do this you will need to override createDialogArea
and change the layout. Something like:
@Override
protected Control createDialogArea(Composite parent) {
Control result = super.createDialogArea(parent);
Text text = getText(); // The input text
GridData data = new GridData(SWT.FILL, SWT.TOP, true, false);
data.heightHint = convertHeightInCharsToPixels(5); // number of rows
text.setLayoutData(data);
return result;
}
@Override
protected int getInputTextStyle() {
return SWT.MULTI | SWT.BORDER;
}
Upvotes: 4
Reputation: 2224
For multiple line try this :
@Override
protected int getInputTextStyle() {
return SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL
}
Upvotes: 0
Reputation: 1106
Try something like this:
@Override
protected int getInputTextStyle() {
return SWT.MULTI | super.getInputTextStyle();
}
Upvotes: 0