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

Get help using Construct 2

Post » Wed Apr 06, 2016 11:54 am

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 :
Image


Image

If you can help me it would GREAT !
B
4
Posts: 15
Reputation: 232

Post » Wed Apr 06, 2016 1:45 pm

just a thought... testPDF.capx
Image
B
64
S
23
G
7
Posts: 1,481
Reputation: 10,823

Post » Wed Apr 06, 2016 1:57 pm

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.
B
88
S
29
G
14
Posts: 1,154
Reputation: 15,003

Post » Wed Apr 06, 2016 3:07 pm

korbaach wrote: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.

Image

jobel wrote: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.
B
4
Posts: 15
Reputation: 232

Post » Wed Apr 06, 2016 3:32 pm

if you type:
Code: Select all
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

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
Image
B
64
S
23
G
7
Posts: 1,481
Reputation: 10,823

Post » Wed Apr 06, 2016 3:37 pm

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.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
131
S
29
G
81
Posts: 5,328
Reputation: 56,630

Post » Wed Apr 06, 2016 3:46 pm

you can add else statement
Image
so..in pdf
Image
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
Image
B
64
S
23
G
7
Posts: 1,481
Reputation: 10,823

Post » Wed Apr 06, 2016 4:44 pm

korbaach wrote:if you type:
Code: Select all
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

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?
B
4
Posts: 15
Reputation: 232

Post » Wed Apr 06, 2016 10:33 pm

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 :P :
Image

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

My function :
Image

My interface :
Image

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))
B
4
Posts: 15
Reputation: 232

Post » Thu Apr 07, 2016 4:00 am

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

Image
Image
B
64
S
23
G
7
Posts: 1,481
Reputation: 10,823

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 10 guests