Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How can I force Text widget to break word when wrapping lines?(I am using indigo on windows)
How can I force Text widget to break word when wrapping lines? [message #727794] Wed, 21 September 2011 21:14 Go to next message
Eclipse UserFriend
please help!

for example, if the String "hello world" can not be displayed in one line, the line wrapping happens, it will be displayed like this :

-----------
hello
world
-----------

but I hope this :

-----------
hello worl
d
-----------

this is what I said "break word"

[Updated on: Thu, 22 September 2011 03:10] by Moderator

Re: How can I force Text widget to break word when wrapping lines? [message #727882 is a reply to message #727794] Thu, 22 September 2011 02:34 Go to previous messageGo to next message
Eclipse UserFriend
On 2011-09-22 03:14, cn.fred wrote:
> please help!

This is one of those postings where I would like to point to

http://catb.org/~esr/faqs/smart-questions.html

Please give a concrete example what you want to realize. A short snippet
similar to the SWT snippets would explain a lot.

Have to read

http://book.javanb.com/swt-the-standard-widget-toolkit/ch15lev1sec12.html

? This article explains some subtleties in regard to wrapping in SWT.

If your problem is of the kind described in

http://stackoverflow.com/questions/5014765/simultaneously-right-align-and-wrap-text-in-an-swt-label-in-linux-gnome

check the suggested solutions there, but this is all guessing on my side.

Last but not least: If you need a widget that *actively* breaks a
*single* word like "hippopotamus" automatically into one of the possible
syllables in "hip-po-pot-a-mus", you need to write your own component:
This requires knowledge about the natural language that is presented in
the text.

HTH & Greetings from Bremen,

Daniel Krügler
Re: How can I force Text widget to break word when wrapping lines? [message #727885 is a reply to message #727794] Thu, 22 September 2011 02:44 Go to previous messageGo to next message
Eclipse UserFriend
On 22.09.2011 03:14, cn.fred wrote:
> please help!
Set the SWT.WRAP style when creating the widget.

Dani
Re: How can I force Text widget to break word when wrapping lines? [message #727890 is a reply to message #727882] Thu, 22 September 2011 03:08 Go to previous messageGo to next message
Eclipse UserFriend
sorry, I did not describe more, see my edits
Re: How can I force Text widget to break word when wrapping lines? [message #727893 is a reply to message #727885] Thu, 22 September 2011 03:13 Go to previous messageGo to next message
Eclipse UserFriend
I am not asking about line-wrap(Create a Text Widget with SWT.Wrap), see my edits.
Re: How can I force Text widget to break word when wrapping lines? [message #727898 is a reply to message #727890] Thu, 22 September 2011 03:22 Go to previous messageGo to next message
Eclipse UserFriend
On 2011-09-22 09:08, cn.fred wrote:
> sorry, I did not describe more, see my edits

The are no edits possible on eclipse.platform.rcp.

Greetings from Bremen,

Daniel Krügler
Re: How can I force Text widget to break word when wrapping lines? [message #728090 is a reply to message #727794] Thu, 22 September 2011 10:10 Go to previous messageGo to next message
Eclipse UserFriend
There isn't a way to make Text or StyledText behave like this on their own. You would need to do the work to listen for Modify events on the Text, and then do measurements on the control's string to determine whether additional line breaks need to be inserted to give the appearance of the behaviour that you want. For an example of measuring a string see http://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet93.java .

Grant
Re: How can I force Text widget to break word when wrapping lines? [message #728324 is a reply to message #728090] Thu, 22 September 2011 21:45 Go to previous messageGo to next message
Eclipse UserFriend
there is a way to make Text behavior like that on SWT GTK Version.

Re: How can I force Text widget to break word when wrapping lines? [message #728608 is a reply to message #728324] Fri, 23 September 2011 09:57 Go to previous message
Eclipse UserFriend
How? In SWT's GTK implementation the only case where this happens is
with one "word" that's longer than the width of the text. It's possible
that GTK's native text control supports the behavior you describe, but
SWT does not expose it.

Grant


On 9/22/2011 9:45 PM, cn.fred wrote:
> there is a way to make Text behavior like that on SWT GTK Version.
>
>
Previous Topic:create java project fail in the RCP product.
Next Topic:Where is "Platform Plug-in Developer Guide" in eclipse indigo help
Goto Forum:
  


Current Time: Sat Apr 26 01:54:32 EDT 2025

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

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

Back to the top