Writing text
When coding mobile applications, you might have the need to write text to the screen or external files, such as displaying a level completion message or posting a new high score on a leaderboard. In this recipe, you will learn how to write text to the screen of a mobile device.
How to do it...
Follow the steps in this recipe to write text on the user's screen:
Create a new main stack in LiveCode.
Add a label field to the card with the following properties:
Name:
userInput
Width:
300
foregroundColor: Yellow
Align text left
Size of text:
18
Add the following code to the card:
on openCard put the long date & tab & the long time into fld "userInput" end openCard
Run the app in the mobile simulator. Your results should be similar to what is displayed in the following screenshot:
How it works...
In this recipe, we used the put
command to put data on the screen using a text field. The same command can be used to put data in objects such as buttons, text fields, and so on.
See also
The...