Hello World! 3 ways
What's the first thing you want to learn to do with LiveCode? A "Hello World!" application of course.
This lesson will show you a variety of ways to say "Hello World!" using LiveCode.
Your first stack
First things first, we need a stack so we can start building our application. Go to the File menu and select New Stack - Default Size(1) We now have a stack containing a single card(2)
Adding a field to the stack
Opening the Message Box
Using the Message Box
The Message Box is a command line tool that allows you to try out short scripts and test parts of your program. It provides a convenient output window for debugging and can be used for editing and setting properties. It is one of the more useful components in LiveCode when you are starting out and wanting to try out simple scripts.
to output to the Message Box we simply type
put "Hello World!"
and press return to execute the command and there it is, "Hello World!" is displayed in the Message Box.
To put text into a field we can use almost the same script, we just also specify where to put the text
put "Hello World!" into field 1
Using a dialog box
Using a field and a button
Scripting the button
Now we want to put "Hello World!" into the field when the button is clicked.
1. Go into Edit mode
2. Select the button and open the Script Editor for the button by clicking the Code button in the Menubar
You will see the Script Editor pre-populated with an empty on mouseUp handler.
We can reuse our line of LiveCode from earlier, this time we want it to be executed when the button is clicked so it goes in the mouseUp handler.
on mouseUp put "Hello World!" into field 1 end mouseUp
Compile the script by clicking Apply(3), go into Run mode(4) and click the button.