Announcement

Collapse
No announcement yet.

UMG: Text Wrapping Issue

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    UMG: Text Wrapping Issue

    I am working on a text-based chat system (a chatbox), and am trying to get it styled nicely. What I'd like to do is display the player's username in one color, and the actual text in another. I realized that I need to use 2 seperate text blocks to do this, but now have encountered a wrapping problem:
    Click image for larger version

Name:	4ba248ea27.jpg
Views:	1
Size:	40.1 KB
ID:	1160577

    As you can see, I have my username, and then my text. The obvious problem is that the grey text is not wrapping underneath the username, but is just wrapping where the beginning of the text starts.
    An easy way to fix this would be to have my grey text start where the username starts, and just overlay the red username onto the text. So instead of my text being "WWWWW.....", it would be "[Test_User]: WWWWW....." That way the grey text would wrap underneath the username. Here is what that looks like:
    Click image for larger version

Name:	782d3ce000.jpg
Views:	2
Size:	37.7 KB
ID:	1160579

    As you can see, the text now wraps underneath the username. The problem now is that if you look very closely at the red username, you can see that there is a bit of grey on the edges of the red, that is because behind the red, I have the username except in grey. Is there any way to have the text block start after the username, but wrap to be underneath it?
    Attached Files
    Marketplace Assets

    Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
    Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
    Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

    #2
    Bump, the issue still stands.
    Marketplace Assets

    Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
    Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
    Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

    Comment


      #3
      If your using a widget, could you have a main vertical box for the chat boxes and then create a horizontal box with 2 text boxes, one with the username, the other with the chat data. The chat data would be filled and would look similar to the image below.
      Click image for larger version

Name:	mRIeu5W.png
Views:	1
Size:	36.1 KB
ID:	1087196

      Comment


        #4
        That's the problem, I don't want it to be filled like that, I want the blah s to be wrapped underneath the username, just like in the 2nd picture I posted. The only reason it is wrapping good in the 2nd pic is that I am middle-manning it like I described in my post, it also adds a ugly grey outline to the username when I do it.
        Marketplace Assets

        Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
        Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
        Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

        Comment


          #5
          I played in the widget editor for a minute and the best thing I could come up with is a pretty nasty workaround but it might serve your purpose depending on how you generate your chat lines. Basically I used a uniform grid panel with two text boxes in it and just get the length of of the username text box and add that many spaces to the actual words that were typed. It's super ugly but all I could think of.
          Movable Widgets

          Comment


            #6
            Well, that only works if your font is using fixed-width characters(an M takes up the width of 2-3 spaces), am I correct ? I did try something where I retrieved the desired size of the username, and did some math, and added that many spaces, but it was inconsistent when resizing the UMG/username, and would sometimes clip depending on the lenth.
            Marketplace Assets

            Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
            Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
            Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

            Comment


              #7
              Originally posted by Jamendxman3 View Post
              That's the problem, I don't want it to be filled like that, I want the blah s to be wrapped underneath the username, just like in the 2nd picture I posted. The only reason it is wrapping good in the 2nd pic is that I am middle-manning it like I described in my post, it also adds a ugly grey outline to the username when I do it.
              I see, my apologizes but I didn't get the issue. Ok so I played around with a couple of the panel's to find one that wraps and I think I found a good way to do what you want. If you take a Overlay panel and add 2 text objects, the first one can be the username like so '[Username]:' and the seccond one you fill with your text data. You will have to add a number of spaces to the beginning of the text data so that it won't overlap but in my test, you need x2 the spaces of the username textbox length. Here's how it looks for me. Hope that helps!
              Click image for larger version

Name:	Untitled.png
Views:	1
Size:	104.1 KB
ID:	1087205

              Edit: Was replying before your last post, you may also want to take a look at SRichTextBlock, but know that it's only in C++ right now. You can change the color of text with xml and it will wrap with the text because it's all in the same object.
              https://answers.unrealengine.com/que...textblock.html

              Edit 2: Also found: https://forums.unrealengine.com/show...-string-(UMG-) So you will have to expose it with C++ but will be there.
              Also https://forums.unrealengine.com/show...ialogue-System
              Last edited by Dzuelu; 09-07-2015, 11:11 PM.

              Comment


                #8
                Unfortunately, the 2 spaces per character is only close, but not close enough. This works fine for the word username, but if the username is 5 capital m's, then 2 spaces per character is not enough, and the M's will clip through the text.
                Last edited by Jamendxman3; 09-07-2015, 10:32 PM.
                Marketplace Assets

                Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
                Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
                Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

                Comment


                  #9
                  I think i solved it. sry for reviving this old tread. Perhaps more ppl like me is ending up here.

                  Sry for reviving this but have been scratching my head with this for a while now and i think i solved your problem. Don't use spaces and guess the exact length instead use the format text function.

                  The solotion i'm using in my widget:
                  Overlay
                  Text message - Binded to Actual Text
                  Text Sender - Binded to Actual Sender

                  Click image for larger version

Name:	Text wraping problem.png
Views:	1
Size:	178.8 KB
ID:	1116365

                  Comment


                    #10
                    Have you considered this plugin? https://forums.unrealengine.com/show...-Rich-Text-Box
                    It allows you to specify multiple colours in a text box

                    Comment

                    Working...
                    X