I am using following for TextArea
ToolBar bar = new ToolBar(box,SWT.NONE);
ToolItem item = new ToolItem(bar, SWT.SEPARATOR);
Text text = new Text(bar, SWT.BORDER | SWT.MULTI);
item.setWidth(width);
item.setControl(text);
GridData data = new GridData();
data.verticalAlignment = SWT.CENTER;
data.grabExcessHorizontalSpace = true;
data.grabExcessVerticalSpace = true;
text.setLayoutData(data);
I want to display a multi line text box, currently its accepting multi line text but showing only a single line at a time.
Any idea how to set the number of rows to be displayed ?
Thanks.
You can also use Text.getLineHeight() to determine the height of a single line of text, you don't need a GC for that:
final Text text = new Text(container, SWT.BORDER | SWT.WRAP);
GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
gridData.heightHint = 5 * text.getLineHeight();
text.setLayoutData(gridData);