Humanities Home page   Office of Digital Humanities
Back     BYU LiveCode Lessons Gateway

Digital Humanities & Technology 210

Object Properties


By the end of this reading you should know the following:

  1. Know the proper format for referring to a property in a LiveCode scripting statement.
  2. Know how to use the set command to change a property of an object in the scripting language.
  3. Understand the difference between the name of an object and the short name of an object.
  4. Know how the properties the textFont, the textStyle, and theTextSize correspond to settings in the Text Formatting panel of the Property Inspector and the Text menu.
  5. Know what the location property of an object refers to (i.e., how is it measured?)
  6. Understand that every property that can be set in the Property Inspector can also be set in scripting.

Properties and Scripting

As we discussed before, every LiveCode object has properties, or characteristics that determine its appearance and function: its name, location, style, attributes, text characteristics, etc. These are established when the object is created and mostly set by choices made from the properties palette. The LiveCode scripting language has a full range of commands to examine and manipulate these properties within a handler. In other words, it is possible with any given object to view and change the characteristics of objects through the use of transcript commands within a handler

References to a property in Transcript have the general form:

the property of object


both the and of are required keywords
property is the name of the property in question.
object is a reference to a stack, card, button, field, or other LiveCode object.

Common Properties

As has been noted before, there are a number of properties which are common to all types of objects. Most properties can be accessed easily within a handler wherever the value of that property is appropriate. The most common methods are by either an if, a put, or a get statement:

if the property of object is propvalue then...
put the property of object into container
get the property of object


property is the name of the property in question.
object is a reference to a button, field or other LiveCode object.
propvalue is the value of the property in question (including booleans).
container is a reference to any container (e.g. field or variable.)

Up to now you have usually set properties by using the properties palette. However, you may use the set command within a handler to change directly a particular property of an object to a particular value:

set the property of object to propvalue


property is the name of the property in question.
object is a reference to a button, field or other LiveCode object.
propvalue is the value of the property being adjusted (including booleans).

The power of this capability is that you can access the properties of objects within scripts, i.e., their values are available for reference and use. You can then script handlers to perform certain functions based upon the values of the various properties, including setting that property to a new value. This implies, then, that through the judicious use of handlers for various messages, you can alter the appearance and function of various objects.

Here are a few of the properties common to all objects which may be accessed (with get or put) and manipulated (with set):

Text Properties

In addition to changing them in the property inspector, you can both read and set all of the text and font-related attributes of objects using scripting. (In fact, in early versions of LiveCode, the only way to change the text settings of buttons was via the set command.)

There is a pair of text-related properties that apply only to fields:

Color Properties

All the color-related attributes of an object are properties that can be both read and set:

For any of these properties, a standard color name may be used ("red", "blue", "aquamarine", "mistyRose", etc.), or the RGB values ("255,0,128"), or the HTML-style color indicator ("#A366FF").

Size and Position Properties

LiveCode dimensions diagram

LiveCode Size and Position Properties

The LiveCode coordinate system uses pixels as the unit of measurement and the upper-left corner of the card as the point of reference. Usually two numbers are provided, separated by commas. The first has reference to X (meaning the number of pixels from the left edge of the card), and the second has reference to Y (meaning meaning the number of pixels down from the top of the card).

Other Position and Dimension Properties: There are several more properties pertaining to the position and dimensions of objects:

There is no validity checking. You can set right less than left and top greater than bottom and sort of turn the object inside out!

The chart at right shows all of the different location and dimension properties and how they relate to each other.

Button Properties

There are two properties unique to buttons that are closely related:

All button styles work in this manner except checkBox and radioButton. These two styles hilite on one full click and restore on another full click. With autoHilite you get the default behavior, which is usually adequate. However, using the hilite property you can control hiliting explicitly in the script, or have certain events take place based upon the hilite of a certain button.

Other button properties that can also be retrieved and set include:

Field Properties

A number of properties unique to fields can also be retrieved and set. The possible values for these properties are either true or false:

Later in the course we will talk more about the properties of the text within containers (fields and variables).

Graphics Properties

Graphics in LiveCode have their own properties. They are very similar to those of fields and buttons, such as font attributes:

Each style of graphic has unique properties also that go along with it. For example, with the "oval" graphic, the Arc Angle and start Angle can be set.

Image Properties

All of the properties which are common to objects are accessible and have the ability to be manipulated with image objects. There are some useful unique properties, however:

Further Exploration

There are dozens of other properties, both shared and unique to the different object types, that will not covered in this course. These may be discovered either by reading the documentation or by using the property inspector. Upon examining the property inspector for any object, hovering the mouse over the various properties will give you the actual name of the property by which it must be referenced. Using that one may obtain the value of that property for that particular object and thereby determine how that property may be altered. Experimentation is welcome here (and even encouraged), though you may get some unexpected results.

Back     BYU LiveCode Lessons Gateway
Maintained by Devin Asay.
Copyright © 2005 Brigham Young University.
This page last updated on May 30, 2017 17:39:39.