Livecode Wiki

LiveCode is a object-based language. It uses many different objects, such as buttons, fields, windows, cards, graphics, etc. They are collectively called the User Interface. The first step in any LiveCode program is to setup the User Interface.

The basics of a LiveCode User Interface is the stack. It gets this name from the idea of a stack of cards. A stack has at least one card which is represented on screen as a window. Each stack can have any number of cards and each card can have any number of card objects - buttons, fields, graphics, etc. By changing the card that is displayed, you can drastically change the User Interface.

The second step is to make that interface do what you want. That requires you to write in the LiveCode script language. The code used by LiveCode is simple and easy to learn, very English-like. That means much of it can be understood in both English and LiveCode. This makes it more verbose than other languages, but that can be a good thing in that you will understand it better. Less comment statements are required because it tends to document itself.

Most computer languages are only the script, you write the program like a letter from top to bottom. But LiveCode is different, the program is really many small pieces called scripts. Each object in the User Interface contains a script. You write many different scripts instead of one big program.

Each script contains several different handlers and each handlers responds to a different User Interface event. That event might be a mouse click on an object, the selection of a menu item, the push of a particular key on the keyboard, or many many other events. As a result, LiveCode is called an event-driven language.

When the user causes an event, LiveCode sends a message to the appropriate User Interface object. If you have written a handler for that event, it is executed. That User Interface object responds to the event.

The general form of a handler is usually of this form:

on <message>
    do some clever stuff here
end <message>

For example if we want to create a button that shows a new window with "Hello world!". Well, just drag and drop a button to your stack, right click on it and select "edit script" (this will activate the code editor). Then add the following code:

on mouseUp
  answer "Hello world!"
end mouseUp

This script contains the handler "on mouseup" which will respond to the mouseUp message that is sent at the end of a mouse button click. The handler above will then put up a dialog window showing "Hello World!"

Check out the following concepts to learn LiveCode:

Basic concepts[]

Advanced concepts[]

Programming structures[]

Misc.[]