By the end of this reading you should know the following:
set command to change a property of an object in the scripting language.the name of an object and the short name of an object.the textFont, the textStyle, and theTextSize correspond to settings in the Text Formatting panel of the Property Inspector and the Text menu.the location property of an object refers to (i.e., how is it measured?)As we discussed before, every Revolution 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 Revolution 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
where
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 Revolution object.
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
put the property of object into container
get the property of object
where
property is the name of the property in question.
object is a reference to a button, field or other Revolution object.
propvalue is the value of the property in
question (including booleans).
container is a reference to any container (e.g. field or variable.)
You usually set properties, of course, 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
where
property is the name of the property in question.
object is a reference to a button, field or other Revolution 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):
the name gets the object's local identity:
the kind of object as well as the actual name. Use
short name to get just the name by itself. With long
name you get the object's complete "genealogy".
put the name of field "myfield" |
Result: | ||
put the short name of field "myfield" |
Result: | ||
put the long name of field "myfield" |
Result: | ||
hide statement
with an object, it would make the visible property of that object
have the value of false, and show would then change the
value of the visible property to true.
|
|
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 Revolution, 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:
All the color-related attributes of an object are properties that can be both read and set:
the textColor. 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").

The Revolution 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).
x,y format.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.
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:
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 in Revolution have their own properties. They are very similar to those of fields and buttons, such as font attributes:
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:
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.