Announcement

Collapse
No announcement yet.

How restricting the number of characters in a input text box?

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

    How restricting the number of characters in a input text box?

    Hi.
    My doubt is that. Can you help me?

    Thank you.

    #2
    Click image for larger version

Name:	limitedtextbox.png
Views:	1
Size:	76.8 KB
ID:	1079016

    Every time the user changes something in the text box it checks if the length of the text is greater then or equal to 5, if it is chop 1 from the left and set the text in the text box. This limits it to 4 characters in said text box.

    Edit: I'm pretty sure with this way you could bypass the limit by simply copying in text instead. So you should take the maximum limit - the length of the text > absolute > clamp 1-X and plug that into the "Left Chop" nodes count, that way even if you copy something it should chop it off to the maximum limit.

    Edit2: Something like this would work.
    Click image for larger version

Name:	limitedtextbox2.png
Views:	1
Size:	114.6 KB
ID:	1079017
    Last edited by Tekoppar; 05-28-2015, 09:35 AM.

    Comment


      #3
      Thank you very much, Tekoppar.

      Comment


        #4
        Thank you, friends!

        Comment


          #5
          An alternative is to just use SubString (still using on the suggested ontextchanged)

          https://docs.unrealengine.com/latest...ing/index.html

          Just set length to your maximum allowable size. It will handle 1 or multiple characters.

          Comment


            #6
            I also figured out that you can use the substring method and set the text box that is being edited to this string, which will not allow the user to type any more in the text box than the max length of the substring.

            Comment


              #7
              Originally posted by namrog84 View Post
              An alternative is to just use SubString (still using on the suggested ontextchanged)

              https://docs.unrealengine.com/latest...ing/index.html

              Just set length to your maximum allowable size. It will handle 1 or multiple characters.
              This was useful - thanks
              LinkedIn | Insta | YouTube | SoundCloud | valkyrie-sound.com | Sound Design, Composition, Production

              Comment

              Working...
              X