Textbox.width = Text.Width deletes string

0 favourites
  • 3 posts
  • Link to .capx file (required!):

    speedy.sh/4ZSmf/sigh.capx

    Steps to reproduce:

    1. Create a textbox with whitespace at the end.

    e.g: "I dislike trying to fix this                               "

    2. Use trim to delete whitespace.. set width of the textbox to Text.TextWidth.

    3. Pin an image to the center of the textbox.

    Observed result:

    Using trim may delete the whitespace, but it will not resize the box. When setting the box to "Text.TextWidth," frequently latter parts of the string are deleted. For example, "I dislike trying to fix this" can become "I "

    Expected result:

    I expected the Textbox to resize to contain ALL of the text, not just the text before the first " "

    Browsers affected:

    Chrome: yes

    Firefox: iframe did not load correctly

    "[20:37:45.634] Error: WebGL: A texture is going to be rendered as if it were black, as per the OpenGL ES 2.0.24 spec section 3.8.2, because it is a 2D texture and its width or height is equal to zero. progressfestival.com/BandNameGame/c2runtime.js:38%22

    Internet Explorer: yes

    Operating system & service pack:

    Windows 7

    Construct 2 version:

    r153

    I apologize in advanced if this has ever been addressed in the C2 forums or I am ignorantly posting something in the bugs section that does not belong here. If you would like to see an example in action, please visit progressfestival.com/test.php

    ^^you will see sections and portions of artist names, from an AJAX request to

    progressfestival.com/GameTest2.php

    which has all of the artist correctly listed, separated by commas.

    One final thing: The AJAX request works perfectly if "Textbox.setWidth=Text.Width" is disabled. Almost every artist name does not load correctly otherwise.

  • The .capx you provided does not appear to match the reproduction steps. It does not use the TextWidth expression at all.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I am having a similar issue now. TextWidth returns 0 and I would like to resize the Box containing the text so that it fits the given text perfect.

    I tried the len(TextTest.Text) *12 method but I always have spare space or it cuts the word in some cases.

    Here is my .capx file.

    drive.google.com/open

    Any suggestions Ashley ?

    Thank you!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)