Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 10:09 Go to next message
Roger is currently offline RogerFriend
Messages: 9
Registered: July 2009
Junior Member
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 13:42 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika IrvineFriend
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 Go to previous message
Roger is currently offline RogerFriend
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
>>
>>
Previous Topic:PLZ REPLY: JNI does NOT work under workbench!
Next Topic:Mouse cursor
Goto Forum:
  


Current Time: Fri Oct 30 08:34:52 GMT 2020

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

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

Back to the top