Adobe 65009333 Scripting Guide - Page 58

For the complete script, see ComplexUI., Creating a more complex user interface

Page 58 highlights

User Interfaces Creating a more complex user interface 58 For the complete script, see ComplexUI. var myDialog = app.dialogs.add({name:"ComplexUI", canCancel:true}); with(myDialog){ var mySwatchNames = app.swatches.everyItem().name; //Add a dialog column. with(dialogColumns.add()){ //Create a border panel. with(borderPanels.add()){ with(dialogColumns.add()){ with(dialogRows.add()){ //The following line shows how to set a property //as you create an object. staticTexts.add({staticLabel:"Message:"}); //The following line shows how to set multiple //properties as you create an object. var myTextEditField = textEditboxes.add( {editContents:"Hello World!", minWidth:180}); } } } //Create another border panel. with(borderPanels.add()){ with(dialogColumns.add()){ with(dialogRows.add()){ staticTexts.add({staticLabel:"Point Size:"}); //Create a number entry field. Note that this field uses //editValue rather than editText (as a textEditBox would). var myPointSizeField = measurementEditboxes.add({editValue:72, editUnits:MeasurementUnits.points}); } } } //Create another border panel. with(borderPanels.add()){ with(dialogColumns.add()){ with(dialogRows.add()){ staticTexts.add({staticLabel:"Paragraph Alignment:"}); var myRadioButtonGroup = radiobuttonGroups.add(); with(myRadioButtonGroup){ radiobuttonControls.add({staticLabel:"Left", checkedState:true}); radiobuttonControls.add({staticLabel:"Center"}); radiobuttonControls.add({staticLabel:"Right"}); } } } } //Create another border panel. with(borderPanels.add()){ with(dialogColumns.add()){ with(dialogRows.add()){ staticTexts.add({staticLabel:"Text Color:"}); } var mySwatchDropdown = dropdowns.add({stringList:mySwatchNames, selectedIndex:4}); } } } }

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88

User Interfaces
Creating a more complex user interface
58
For the complete script, see ComplexUI.
var myDialog = app.dialogs.add({name:"ComplexUI", canCancel:true});
with(myDialog){
var mySwatchNames = app.swatches.everyItem().name;
//Add a dialog column.
with(dialogColumns.add()){
//Create a border panel.
with(borderPanels.add()){
with(dialogColumns.add()){
with(dialogRows.add()){
//The following line shows how to set a property
//as you create an object.
staticTexts.add({staticLabel:"Message:"});
//The following line shows how to set multiple
//properties as you create an object.
var myTextEditField = textEditboxes.add(
{editContents:"Hello World!", minWidth:180});
}
}
}
//Create another border panel.
with(borderPanels.add()){
with(dialogColumns.add()){
with(dialogRows.add()){
staticTexts.add({staticLabel:"Point Size:"});
//Create a number entry field. Note that this field uses
//editValue rather than editText (as a textEditBox would).
var myPointSizeField = measurementEditboxes.add({editValue:72,
editUnits:MeasurementUnits.points});
}
}
}
//Create another border panel.
with(borderPanels.add()){
with(dialogColumns.add()){
with(dialogRows.add()){
staticTexts.add({staticLabel:"Paragraph Alignment:"});
var myRadioButtonGroup = radiobuttonGroups.add();
with(myRadioButtonGroup){
radiobuttonControls.add({staticLabel:"Left",
checkedState:true});
radiobuttonControls.add({staticLabel:"Center"});
radiobuttonControls.add({staticLabel:"Right"});
}
}
}
}
//Create another border panel.
with(borderPanels.add()){
with(dialogColumns.add()){
with(dialogRows.add()){
staticTexts.add({staticLabel:"Text Color:"});
}
var mySwatchDropdown = dropdowns.add({stringList:mySwatchNames,
selectedIndex:4});
}
}
}
}