[Solved] Problem with word wrap and new widget embedding?

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

Serilyn
Just popping in
Just popping in
Posts: 2
Joined: Tue Oct 20, 2009 02:57

[Solved] Problem with word wrap and new widget embedding?

Postby Serilyn » Tue Oct 20, 2009 03:32

I used the new CEGUI (v0-7 branch revision 2298, since updated to 2328) for my Ludum Dare Mini entry last weekend. The widget embedding markup was helpful in making a wiki-browser-like window for game information, but I noticed a problem with word wrap and widgets. The green words are StaticText widgets. The first cutoff green widget should say "finback" and the second cutoff green widget should be "Mendelian Traits"
Image

I am using the Ogre renderer. The widget with the wrapping text is a WindowsLook/StaticText and the embedded widgets are also WindowsLook/StaticText widgets. Is there something I'm missing here or did I stumble on a bug?

Here is the essential section of my CEGUI log:

Code: Select all

19/10/2009 20:10:18 (Std)    ---- Version 0.7.1 (Build: Oct 17 2009 Debug Microsoft Windows MSVC++ 9.0 32 bit) ----
19/10/2009 20:10:18 (Std)    ---- Renderer module is: CEGUI::OgreRenderer - Official OGRE based 2nd generation renderer module. ----
19/10/2009 20:10:18 (Std)    ---- XML Parser module is: CEGUI::ExpatParser - Official expat based parser module for CEGUI ----
19/10/2009 20:10:18 (Std)    ---- Image Codec module is: OgreImageCodec - Integrated ImageCodec using the Ogre engine. ----
19/10/2009 20:10:18 (Std)    ---- Scripting module is: None ----
19/10/2009 20:10:18 (Std)    
Last edited by Serilyn on Tue Oct 20, 2009 16:56, edited 1 time in total.

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Re: Problem with word wrap and new widget embedding?

Postby scriptkid » Tue Oct 20, 2009 07:10

Hi and welcome :)

Do you mean that you are using a widget for the black text, and others for the green text? Word-wrapping only applies to strings, not to widgets. If you are using different widgets, do you know about the string colouring functionality?

For example you can now say:

Code: Select all

setText("This is black, [colour='FF00FF00']and this is green.");


That way, maybe you can simplify your widget so that it uses only one text box.

HTH.
Check out my released snake game using Cegui!

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Problem with word wrap and new widget embedding?

Postby CrazyEddie » Tue Oct 20, 2009 08:53

Actually, the new string formatting can take child windows and reposition them dynamically in-line with the text and apply the formatting also to those windows (as demoed in some videos a while ago). I think OP is using this technique in order to detect clicks on that green text - like hyper-links.

Why the formatting is not working, I do not know, although I'll run a test. If it turns out to be a bug, I can't guarantee a fix until after the 0.7.1 release, since the code is frozen while that release is worked on. BTW, we don't normally work quite like this, but this release is a little different since myself and scriptkid are unable to sync-up for this release (because I am going away at the end of this week - see announcement later!) - so the code is frozen to ensure that whenever we make our packages we use the same code.

I'll let you know if I can reproduce the issue.

CE.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Problem with word wrap and new widget embedding?

Postby CrazyEddie » Tue Oct 20, 2009 10:41

Yes, this is a bug that was introduced when I fixed another bug (as is the way ;)). The fix for this one is:

Code: Select all

Index: cegui/src/CEGUIRenderedString.cpp
===================================================================
--- cegui/src/CEGUIRenderedString.cpp   (revision 2330)
+++ cegui/src/CEGUIRenderedString.cpp   (working copy)
@@ -206,12 +206,14 @@
             ++left.d_lines[left_line].second;
         }
     }
-    // can't split, so xfer the whole component to the left (FIX #306)
-    else
+    // can't split, if component width is >= split_point xfer the whole
+    // component to it's own line in the left part (FIX #306)
+    else if (c->getPixelSize().d_width >= split_point)
     {
+        left.appendLineBreak();
         left.d_components.push_back(d_components[0]);
         d_components.erase(d_components.begin());
-        ++left.d_lines[left_line].second;
+        ++left.d_lines[left_line + 1].second;
         --d_lines[0].second;
     }


CE.

Serilyn
Just popping in
Just popping in
Posts: 2
Joined: Tue Oct 20, 2009 02:57

RE: Problem with word wrap and new widget embedding?

Postby Serilyn » Tue Oct 20, 2009 16:55

Yes using the widgets like hyper-links was precisely what I was doing. The fix works great. Thanks CE :D

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: [Solved] Problem with word wrap and new widget embedding?

Postby CrazyEddie » Wed Oct 21, 2009 08:37

Great, glad it's working for you. And better than that, in spite of what I said above, we managed to get it in for the soon to be released 0.7.1 too :)

CE.

kili
Not too shy to talk
Not too shy to talk
Posts: 45
Joined: Fri Apr 27, 2007 06:17

Re: [Solved] Problem with word wrap and new widget embedding?

Postby kili » Fri Nov 06, 2009 07:24

Hi CE,

There are still something strange:
Image
the words after [hyper-link] should follow it like:
Image

Would you please add one tag to separate English/Non-English Letters?
I've hacked such things in Font and MultiLineEditbox in 0.6x version,
but don't want to do the same thing in each new version. :(


Return to “Help”

Who is online

Users browsing this forum: No registered users and 20 guests