Announcement

Collapse
No announcement yet.

Get number of Lines in 'Text' Widget - Function

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

    [FEATURE REQUEST] Get number of Lines in 'Text' Widget - Function

    Hello, i think title speak for itself. Function must show number of lines in 'Text' Widget, for multi-line or single-line.
    This function will be very useful for safe and easy transfer text from page to page for example.
    Please, dear Epic Games
    Last edited by Bormak; 07-31-2019, 06:27 AM.

    #2
    You can simply convert to string and split by "\n" into an array then count elements in array.
    | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

    Comment


      #3
      Originally posted by BrUnO XaVIeR View Post
      You can simply convert to string and split by "\n" into an array then count elements in array.
      Does that actually work? Like if you put in a large paragraph and have the box set to autowrap, will the string conversion actually have the \n's in there?

      Comment


        #4
        Originally posted by BrUnO XaVIeR View Post
        You can simply convert to string and split by "\n" into an array then count elements in array.
        Nope. You cant use this "solution" with several localizations, autowrap etc. Line Counter should be a built in function.

        Comment


          #5
          If Epic implement that function it would do exactly the same thing.
          Count line breaks and return a number.

          text wrapping is not line break.
          | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

          Comment


            #6
            Originally posted by BrUnO XaVIeR View Post
            If Epic implement that function it would do exactly the same thing.
            Count line breaks and return a number.

            text wrapping is not line break.
            Well there should be an easy way to count lines from a wrapped textbox. Where basically, you'd just access a variable for it and it would spit out an integer.

            Comment


              #7
              But why? Shouldn't be text auto-wrapped separately in the next widget?

              Comment


                #8
                EDIT: I started over with my explanation. What I'm referring to is for textblocks and not textboxes, but you could implement some kind of similar method for textboxes that you type into.

                -Big wall text needs to be put inside small textblock that has autowrap enabled
                -You want to break up the wall of text into "pages" that will fill the block
                -Based on the current font settings, you need to know how many lines you can fit in there

                So what I propose is some kind of function that looks like the following:

                Inputs:
                -Text trying to be fit into block
                -Which textblock
                -Possibly have inputs for font settings like if you were getting ready to display with different font settings?

                Outputs:
                -Boolean that outputs true if it fits, false if it doesn't
                -Integer that outputs how many lines fit
                -Text portion that fits into the textblock
                -Remainder of the text that doesn't fit?

                Though I suppose if it has this kind of carry over output like this, you wouldn't really need it to output the number of lines, but it still might be useful for something...

                Comment

                Working...
                X