Often the first thing you learn to do in a new language is to display "Hello World", this lesson will show you how to do this in LiveCode.
The mouseUp message
An example stack
For this example we will create a new main stack from the File Menu.
Adding a button to the stack
We will the add a button to the stack by dragging it from the Tools Palette(1). Select the button by choosing the edit tool (2) and selecting the button (3).
Then open the Object Inspector from the Object Menu and name the button "Say Hello" (4)
Adding code to the button
The mouseUp handler for the button contains only one line
on mouseUp answer "Hello World!" end mouseUp
The answer command displays a dialog box with the text you specify. When you click the button, LiveCode sends a mouseUp message to it. The message triggers the mouseUp handler, which displays a dialog box that says "Hello World!"
Open the script editor for the button by selecting Object Script from the Object menu. Then add the above handler into the button script and try it by clicking the button.
You can display a message in a variety of ways. For example, in the LiveCode development environment, you can use the Message Box to show a message using the put command.
on mouseUp put "Hello World!" end mouseUp
You can also use the put command to put text into any field object:
on mouseUp put "Hello World!" into field "Message" end mouseUp