Page 1 of 1

SOLVED - Go to the next line of a text field?

Posted: Sat Oct 10, 2015 11:14 pm
by CoreySchroeder
I have some text that I would like to display in a multiline field, however I cannot get it to work properly

Code: Select all


on mouseUp
put varName1 & " is very fast!" into field "fldOutput"
put varName2 & " is not nearly as fast as " & varName1 & "!" into field "fldOutput"
put varName3 & " is the slowest of all!!!" into field "fldOutput"
end mouseUp

I'd like the output to read:

John is very fast!
Bob is not nearly as fast as John!
Steve is the slowest of all!!!

However my field only displays one line of text - the last line entered.
I assume the program is actually showing all three lines, but the first two are being displayed so quickly I don't notice, then the program stops when displaying the last line.

So, how can I have the program display all of the lines mentioned above?
How can I move to the next line of the field in livecode?

Re: SOLVED - Go to the next line of a text field?

Posted: Sat Oct 10, 2015 11:18 pm
by CoreySchroeder
Just fooling around with this, I realized that I could use a code similar to:

Code: Select all

put "blah" into line 1 of field "fldOutput"
put "blahblah" into line 2 of field "fldOutput"
I didn't read any documentation, just tried what felt natural.
Tip of the hat to the livecode "english like" syntax - always surprises me!

Re: SOLVED - Go to the next line of a text field?

Posted: Sat Oct 10, 2015 11:21 pm
by FourthWorld
CoreySchroeder wrote:I didn't read any documentation, just tried what felt natural.
That's the goal. Programming in any language can get complicated at times, and LiveCode is no exception. But with the design of the language, most of the time you've already accomplished enough to be more than motivated to figure out anything that might be difficult.

Re: SOLVED - Go to the next line of a text field?

Posted: Sat Oct 10, 2015 11:53 pm
by Simon
Hi Corey,
This code;

Code: Select all

put "blah" into line 1 of field "fldOutput"
put "blahblah" into line 2 of field "fldOutput"
Can also be written as

Code: Select all

put "blah"  & cr into field "fldOutput"
put "blahblah" after field "fldOutput"
cr is return and "after" is good to know because there is also a "before" :)

Simon