Within my text field on LiveCode I would like two separate lines of text. It would be set out like this:
First line of sentence
Second line of sentence
How do I do this?
Within my text field on LiveCode I would like two separate lines of text. It would be set out like this:
First line of sentence
Second line of sentence
How do I do this?
If you enter text manually, you type the return key or the enter key to add a return character to a text field. You can also do this by means of a script.
Use cr
to define returns in text fields. E.g. if you have one stack with one field, execute the following line to put two lines into the text field:
put "First line of sentence" & cr & "Second line of sentence" into field 1
You can include this line in a mouseUp handler in a button for instance.
You can take this a step farther, and become more familiar with what LC calls "chunk expressions". Say you have a single sentence in a field. Consider this in the script of a button:
on mouseUp
put return after word 3 of fld "yourField"
end mouseUp
Now try this:
on mouseUp
put return & return after word 3 of fld "yourField"
end mouseUp
I was wondering the same thing then kept tinkering and found the "recipe" almost certain there is a better way, but this was logically the best I could think of. Still learning the docs and couldn't find a todo list example.
on mouseUp
put the text of field"NewItem" into NewItem
put the text of field"GroceryList" into GroceryList
set the text of field"GroceryList" to empty
put GroceryList & return & NewItem into GroceryList
set the text of field "GroceryList" to GroceryList
set the text of field"NewItem" to empty
end mouseUp