Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Why StyledText dose not word-wrap in SWT3.0
Why StyledText dose not word-wrap in SWT3.0 [message #445360] Thu, 04 November 2004 05:09 Go to next message
Eclipse UserFriend
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 #445365 is a reply to message #445360] Thu, 04 November 2004 08:42 Go to previous messageGo to next message
Eclipse UserFriend
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] Thu, 04 November 2004 22:12 Go to previous message
Eclipse UserFriend
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
>>
>>
Previous Topic:PLZ REPLY: JNI does NOT work under workbench!
Next Topic:Mouse cursor
Goto Forum:
  


Current Time: Wed Jul 23 14:33:41 EDT 2025

Powered by FUDForum. Page generated in 0.04346 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top