How do I a new line with an automatic line break? (TextBox)

0 favourites
  • 13 posts
From the Asset Store
solution for games like "fruit ninja" and drawing applications
  • Hi,

    I have a very big problem that drives me crazy because I have advanced knowledge in HTML5 but I can not solve this problem in construct 2. I wish that when the text jumps a line, this is considered a new line and not an extension of the line.

    Look my pictures to understand :

    If you can help me it would GREAT !

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • just a thought... testPDF.capx

  • is this still happening when you set the TextBox's type to 'textarea'?

    otherwise it seems like you have to format your TextBox's text before you write to the PDF.

  • just a thought... testPDF.capx

    Thank you very much for trying to help me. But your interesting solution does not work for me. In fact when I write the text in the empty text box with automatic breakline it does not insert "newline" when your function is called.

    is this still happening when you set the TextBox's type to 'textarea'?

    otherwise it seems like you have to format your TextBox's text before you write to the PDF.

    Thanks for your help. Yes i 'm using textarea type but how do you want format TextBox text? I cannot insert HTML tags like <p>...</p> or set a margin. The first solution of added "newline" element after x character is a good idea but it doesn't seem working.

  • if you type:

    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[/code:2bqjzgoq] 
    then no...(and you deserved to be all in one line..)
    
    function works exactly what is written..on export...find first " "(empty space) after 30 character and add newline..
    function don' break lines in original text
  • I'm with korbaach on this - your response is nonsensical.

    All automatic breaks rely on the fact that a space will be inserted at some point, otherwise they would never work.

    If you just want a break regardless than do a letter count and force a break, but no system would do such a thing in real life.

  • you can add else statement

    so..in pdf

    but I think it will be ugly in text:

    Perhaps far exposed ag-

    e effects.Now distrusts

    you her delivered reco-

    mmend shameless un-

    feeling he objection co-

    nsisted. She although

    cheerful perceive

  • if you type:

    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[/code:9xom6vgv] 
    then no...(and you deserved to be all in one line..)
    
    function works exactly what is written..on export...find first " "(empty space) after 30 character and add newline..
    function don' break lines in original text
    

    OMG! Sorry i understand my error. Thank you so much for your code it's work! I will try to implant this evening in my application. Do you know if can I call the same function for different textbox?

  • Hi, I tried to insert your code in my project, it works but there is a bug because normally it's supposed to be a text in French :

    I call my function when i click on the button and wait one second :

    My function :

    My interface :

    It's very strange because your code is exactly the same except that I use a array (because text is link with id of patient in array (i do an app for an hospital))

  • you append "character" (word)...........-append just character (variable).... remove "quotes "..

  • you append "character" (word)...........-append just character (variable).... remove "quotes "..

    Thank you !

  • Hey I come back with one question about this manipulation : someone has an idea to avoid format each time you click on the button to format?

  • Maybe it's my question was not clear but it's possible to reverse the process ?

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