Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] is it a bug of StyledText 3.0 ?

Hi,
My StyledText works perfictly in SWT2.0, but in SWT3.0, it is alway
displayed in only one line,
even if the content is multi-line, the hight of the control is always
the same (12).
I figer out that StyledText.computeSize() has been modified from 2.0 to
3.0. If only replace this function with old code, it's OK.
I wonder it's a bug of SWT3.0.
my code is here:

Shell parent = getParent();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE);
shell.setLayout(new GridLayout(5, true));

st = new StyledText(shell, SWT.WRAP);
gridData = new GridData();
gridData.horizontalAlignment = GridData.FILL;
gridData.horizontalSpan = 4;
st.setLayoutData(gridData);
st.setText("aaaaabbbbbcccccdddddeeeeeaaaaabbbbbcccccdddddeeeee");
shell.pack();
shell.open();
Display display = parent.getDisplay();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}

thank you



Back to the top