Livecode Wiki
Advertisement

If you need to make all objects of your User Interface the same color, size, etc., you will use the properties array. First of all create a standard object (a button for example) that will be used as a template. We will name it myTemplate, then let's copy the properties:

put the properties of button "myTemplate" into temp
set the myButtonTemplate of this stack to temp

Now the custom property myButtonTemplate contains an array with all the properties of the button. From myButtonTemplate we must delete the properties that we don't want to change in the existing buttons:

put the myButtonTemplate of this stack into temp
delete variable temp["rect"]
delete variable temp["loc"]
delete variable temp["script"]
set the myButtonTemplate of this stack to temp

Finally let's create command to apply the properties:

on applyTemplate tButton
 put the myButtonTemplate of this stack into temp
 set the properties of button tButton
end applyTemplate

So now just use: applyTemplate "MyButtonName" to get the button standardized.

Advertisement