|
Re: Why StyledText dose not word-wrap in SWT3.0 [message #445365 is a reply to message #445360] |
Thu, 04 November 2004 13:42 |
Veronika Irvine Messages: 1272 Registered: July 2009 |
Senior Member |
|
|
The following works for me:
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
StyledText st = new StyledText(shell, SWT.WRAP );
st.setText("aaaaabbbbbcccccdddddeeeeeaaaaabbbbbcccccdddddeeeee ");
shell.setSize(100, 200);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
Perhaps the problem is in your layout.
"Roger" <yuanq@necas.nec.com.cn> wrote in message
news:cmcv4j$m96$1@eclipse.org...
> Hi,
> I used a StyledText to show long strings, some like:
> st = new StyledText(shell, SWT.WRAP );
> st.setText"aaaaabbbbbcccccdddddeeeeeaaaaabbbbbcccccdddddeeeee ");
> in SWT2.0, word-wrap is perfectly performed.
> bug in SWT3.0, it is always shown in single line, never wraped.
> although i put SWT.MULTI in the style, still not work.
>
> what should i do?
> thanks in advance.
>
> roger
>
>
|
|
|
Re: Why StyledText dose not word-wrap in SWT3.0 [message #445399 is a reply to message #445365] |
Fri, 05 November 2004 03:12 |
Roger Messages: 9 Registered: July 2009 |
Junior Member |
|
|
Dear Veronika Irvine :
Thanks for your advice.
It is true that FillLayout will work,
and if i set gridData.grabExcessVerticalSpace = true;,it works too.
I understand that the word-wrap is ok, but the problem is the hight of the
control cant chang to more than one line.
but the problem is, i used GridLayout, and the return of
StyledText.computeSize(SWT.DEFAULT,SWT.DEFAULT) is diffrent between
SWT2.0 and 3.0. In 2.0, if the text is long, the return value's hight will
be bigger too. but in 3.0, it's alway the same (=12). I think that's why
the control's hight never changed.
thank you .
Veronika Irvine wrote:
> The following works for me:
> public static void main(String[] args) {
> Display display = new Display();
> Shell shell = new Shell(display);
> shell.setLayout(new FillLayout());
> StyledText st = new StyledText(shell, SWT.WRAP );
> st.setText("aaaaabbbbbcccccdddddeeeeeaaaaabbbbbcccccdddddeeeee ");
> shell.setSize(100, 200);
> shell.open();
> while (!shell.isDisposed()) {
> if (!display.readAndDispatch())
> display.sleep();
> }
> display.dispose();
> }
> Perhaps the problem is in your layout.
> "Roger" <yuanq@necas.nec.com.cn> wrote in message
> news:cmcv4j$m96$1@eclipse.org...
>> Hi,
>> I used a StyledText to show long strings, some like:
>> st = new StyledText(shell, SWT.WRAP );
>> st.setText"aaaaabbbbbcccccdddddeeeeeaaaaabbbbbcccccdddddeeeee ");
>> in SWT2.0, word-wrap is perfectly performed.
>> bug in SWT3.0, it is always shown in single line, never wraped.
>> although i put SWT.MULTI in the style, still not work.
>>
>> what should i do?
>> thanks in advance.
>>
>> roger
>>
>>
|
|
|
Powered by
FUDForum. Page generated in 0.03922 seconds