Livecode Wiki
Advertisement

Messages are the bones of the Livecode programming language. First of all let's see the path of the events:

Media 1317826757485 display

Message path

A message is a function that reacts on a event with its name. When an event like "MuoseUp" passes through a button with that message, it activates that message. The event can stop there or be passed to the next object. To pass to the next object in hierarchy use pass keyword:

pass MouseUp

A message it's like function of other programming languages. A message starts with "on MessageName" and ends with "end MessageName", like this:

on MyMessage
 answer "Hello world"
end MyMessage

Messages can have optional values (parameters), look the following example:

on MyMessage myoption1, myoption2
 answer "Hello world" & myoption1 & myoption2
end MyMessage

you can call it with all the following methods:

myMessage
MyMessage 34
MyMessage 34,"hi"

Parameters not used are automatically set to empty.

You can't nest messages inside messages.

You can activate the message of another object in two ways: sending or calling it.

Send

Sending a message, send the specified message to that object, and momentary that object reacts as it is the current active object:

send MouseUp to button MySpecialButton

Call

Call put the message in the current object, so it's behaviour may change:

call "MyMessage 34,hi" of button "myButton"

notice the use of double quote to insert parameters

Advertisement