[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [platform-swt-dev] is it a bug of StyledText 3.0 ?
|
You need to add the line:
gridData.grabExcessHorizontalSpace = true;
This will enable wrapping.
The old StyledText.computeSize code was actually quite wrong because it
based the height it returned on its current width and not on the width
passed in as the wHint argument. Therefore if you changed the width by
only a small amount, it seemed to give the right answer but if you changed
the width by a large amount, you got quite a wrong answer.
"yuhf" <yuhf@xxxxxxxxxxxxxxxx>
Sent by: platform-swt-dev-admin@xxxxxxxxxxx
11/11/2004 03:14 AM
Please respond to
platform-swt-dev
To
<platform-swt-dev@xxxxxxxxxxx>
cc
Subject
[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
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev