Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » why StyledText's hight is not correct in SWT3.0
why StyledText's hight is not correct in SWT3.0 [message #445476] Sat, 06 November 2004 03:17 Go to next message
Eclipse UserFriend
Hi!
My StyledText work perfictly in SWT2.0, if the text is too long, it show
in multi lines. bug the same code in SWT3.0 it is always show in single
line, even if the text is long enough to be wrapped. I used SWT.MULTI
flag, and grid lay out.
I found that the computeSize() in 3.0 always return the same hight, how
can i resove it?
thank you!
roger
Re: why StyledText's hight is not correct in SWT3.0 [message #445699 is a reply to message #445476] Tue, 09 November 2004 14:49 Go to previous messageGo to next message
Eclipse UserFriend
Roger,

Please log a bug report with Platform - SWT, and provide a small snippet
that shows the problem, thanks.

http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/plat form-swt-home/faq.html#whatisasnippet

Grant

"Roger" <yuanq@necas.nec.com.cn> wrote in message
news:cmi1ao$d1e$1@eclipse.org...
> Hi!
> My StyledText work perfictly in SWT2.0, if the text is too long, it show
> in multi lines. bug the same code in SWT3.0 it is always show in single
> line, even if the text is long enough to be wrapped. I used SWT.MULTI
> flag, and grid lay out.
> I found that the computeSize() in 3.0 always return the same hight, how
> can i resove it?
> thank you&#65281;
> roger
>
Re: why StyledText's hight is not correct in SWT3.0 [message #445737 is a reply to message #445476] Wed, 10 November 2004 04:05 Go to previous messageGo to next message
Eclipse UserFriend
Roger wrote:
> Hi!
> My StyledText work perfictly in SWT2.0, if the text is too long, it show
> in multi lines. bug the same code in SWT3.0 it is always show in single
> line, even if the text is long enough to be wrapped. I used SWT.MULTI
> flag, and grid lay out.
> I found that the computeSize() in 3.0 always return the same hight, how
> can i resove it?

Did you try using SWT.WRAP too ?

Henning.
Re: why StyledText's hight is not correct in SWT3.0 [message #445754 is a reply to message #445476] Wed, 10 November 2004 10:21 Go to previous messageGo to next message
Eclipse UserFriend
Assuming that you are using the WRAP style, please log a bug report with
Platform - SWT and provide a stand-alone snippet that shows the problem,
thanks. (If you aren't using WRAP then first try adding it).

http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/plat form-swt-home/faq.html#whatisasnippet

Grant

"Roger" <yuanq@necas.nec.com.cn> wrote in message
news:cmi1ao$d1e$1@eclipse.org...
> Hi!
> My StyledText work perfictly in SWT2.0, if the text is too long, it show
> in multi lines. bug the same code in SWT3.0 it is always show in single
> line, even if the text is long enough to be wrapped. I used SWT.MULTI
> flag, and grid lay out.
> I found that the computeSize() in 3.0 always return the same hight, how
> can i resove it?
> thank you&#65281;
> roger
>
Re: why StyledText's hight is not correct in SWT3.0 [message #445882 is a reply to message #445476] Thu, 11 November 2004 11:47 Go to previous message
Eclipse UserFriend
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.

My tests show that StyledText.computeSize returns the correct result based
on the width passed in as the wHint.

public static void main (String [] args) {
Display display = new Display ();
Shell shell = new Shell (display);
StyledText st = new StyledText(shell, SWT.WRAP);
st.setText("aaaaabbbbbcccccdddddeeeeeaaaaabbbbbcccccdddddeeeee ");
System.out.println("100, SWT.DEFAULT "+st.computeSize(100,
SWT.DEFAULT));
System.out.println("50, SWT.DEFAULT "+st.computeSize(50,
SWT.DEFAULT));
System.out.println("300, SWT.DEFAULT "+st.computeSize(300,
SWT.DEFAULT));
System.out.println("SWT.DEFAULT, SWT.DEFAULT
"+st.computeSize(SWT.DEFAULT, SWT.DEFAULT));
shell.open ();
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}



"Roger" <yuanq@necas.nec.com.cn> wrote in message
news:cmi1ao$d1e$1@eclipse.org...
> Hi!
> My StyledText work perfictly in SWT2.0, if the text is too long, it show
> in multi lines. bug the same code in SWT3.0 it is always show in single
> line, even if the text is long enough to be wrapped. I used SWT.MULTI
> flag, and grid lay out.
> I found that the computeSize() in 3.0 always return the same hight, how
> can i resove it?
> thank you&#65281;
> roger
>
Previous Topic:Test
Next Topic:TableColumn background color
Goto Forum:
  


Current Time: Wed Jul 23 13:41:35 EDT 2025

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

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

Back to the top