Page 1 of 1

Enter multiline text into a text box via script

Posted: Wed Jan 28, 2015 5:42 pm
by SheyMouse
Hello,

I am attempting to script the placement of multiline text into a field when a user presses a button. It's probably my syntax knowledge that is letting me down (and my google-fu).
The scenario is when a user presses a button
This is copied into a field

Code: Select all

Line one of the text
Line two of the text
Line three
In other languages there are escape characters such as "/n" which would insert new line. So the string would be something like:

Code: Select all

"Line one of the text /n Line two of the text /n Line three"
[/i]

Could someone please let me know how the above would be structured in Livecode. I know it's

Code: Select all

put the text "foo" into the field "bar"
but how can I structure "foo"?

Re: Enter multiline text into a text box via script

Posted: Wed Jan 28, 2015 5:48 pm
by Klaus
Hello SheyMouse,

a new line is "made" with CR in Livecode, so do this:
...
put "This is line 1" & CR & "This is line 2" & CR & "This is line 3" into foo
put foo into fld "wherever"
...

Best

Klaus

P.S.
Did you already check these great stacks:
http://www.hyperactivesw.com/revscriptc ... ences.html

Re: Enter multiline text into a text box via script

Posted: Wed Jan 28, 2015 5:48 pm
by sefrojones
try this:

Code: Select all

put "Line one of the text" & cr & "Line two of the text" & cr & "Line three" into field "bar"
CR = carriage return


HTH,

--Sefro

edit: As usual, Klaus was quickest on the draw. :)