CHAPTER 4: User-Interface Tools Size and location objects 76
a button whose name or text value is "cancel" (disregarding case). Because it looks at the name value first,
this works even if the
text value is localized. If there is no suitable button in the dialog, the property value
remains
null, which means that the keyboard shortcut has no effect in that dialog.
To make this feature most useful, it is recommended that you always provide the
name creation property
for buttons meant to be used in this way.
Size and location objects
ScriptUI defines objects to represent the complex values of properties that place and size windows and
user-interface elements. These objects cannot be created directly, but are created when you set the
corresponding property. That property then returns that object. For example, the
bounds property returns
a
Bounds object.
You can set these properties as objects, strings, or arrays.
X e.prop = Object — The object must contain the set of properties defined for this type, as shown in
the table below. The properties have integer values.
X e.prop = String — The string must be an executable JavaScript inline object declaration,
conforming to the same object description.
X e.prop = Array — The array must have integer coordinate values in the order defined for this type,
as shown in the table below. For example:
The following examples show equivalent ways of placing a 380 by 390 pixel window near the upper left
corner of the screen:
var dlg = new Window(’dialog’, ’Alert Box Builder’);
dlg.bounds = {x:100, y:100, width:380, height:390}; //object
dlg.bounds = {left:100, top:100, right:480, bottom:490}; //object
dlg.bounds = "x:100, y:100, width:380, height:390"; //string
dlg.bounds = "left:100, top:100, right:480, bottom:490"; //string
dlg.bounds = [100,100,480,490]; //array
You can access the resulting object as an array with values in the order defined for the type, or as an object
with the properties supported for the type.
Size and location object types
The following table shows the property-value object types, the element properties that create and contain
them, and their array and object-property formats.
Comentários a estes Manuais