Adobe 12040118 Using Help - Page 204

Interacting with controls: events and event callbacks, type specification i.e., dialog

Page 204 highlights

Adobe After Effects Help Using Help Creating User Interface Elements Back 204 ca n cel B t n : Bu tton { text: 'C a n ce l', b ou n d s : [ 2 3 5 , 1 5 , 3 3 5 , 3 5 ] , \ properties:{name:'cancel'} } \ } \ }"; dlg = new Window (alertBuilderResource); The general structure of a window resource specification is a Window type specification (i.e., "dialog"), followed by a set of braces enclosing one or more property definitions. Controls are defined as properties within windows and other containers by specifying the classname of the control in a property definition, with properties of the control enclosed in braces {}, for example: testBtn: Button { text: 'Test' }. Creation properties are specified in a properties property as named properties of an inline object (see example above). The syntax of window resource specification strings is completely described below. Window resource specification syntax The window resource specification syntax is given in BNF (Backus-Naur Form) below: resourceSpec w indowTy peName inlineObject propertiesList propertyDefn propertyName proper t yValue string number inlineArray objectDefn namedObject = '"' w indowTy peName inlineObject '"' = [a modal dialog] = "{" propertiesList "}" = proper t y De fn { "," proper t yDefn } = proper t yName ":" proper t yValue = [a JavaScript property name] = "null" | "true" | "false" | string | number | inlineArray |objectDefn = [a JavaScript string literal] = [any JavaScript integer or real number literal] = "[" proper t y Va lue { "," proper t yVa lue } "]" = ( namedObject | inlineObject ) = [any object classname] inlineObject Note: To create a UI element, the classname in the namedObject definition above can be any element classname referred to in "Types of interface elements" on page 197. For example: "dialog { \ tex t : ' From Re s o u rce', b o u n d s : [ 1 0 , 1 0 , 2 1 0 , 1 1 0 ] , \ box: Panel { \ bounds: [10, 10, 190, 90], \ ok: Button { \ tex t : 'O K ', b o u n d s : [ 4 0 , 3 0 , 1 4 0 , 5 0 }"; Interacting with controls: events and event callbacks When a script creates a window, it typically adds control elements to the window that a user can manipulate, for instance, by clicking a button, entering text in a text box, moving a scrollbar, etc. These user actions or manipulations generate events within the user interface system. The script that creates a window needs a way to be notified of events from that window or from controls within the window. The scripting user interface provides a number of event callback methods that a script can define as properties of any UI element that the script needs to interact with. Using Help Back 204

  • 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
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • 206
  • 207
  • 208
  • 209
  • 210
  • 211
  • 212
  • 213
  • 214
  • 215
  • 216
  • 217
  • 218
  • 219
  • 220
  • 221
  • 222
  • 223
  • 224
  • 225
  • 226
  • 227
  • 228
  • 229
  • 230
  • 231
  • 232
  • 233
  • 234
  • 235
  • 236
  • 237
  • 238
  • 239
  • 240
  • 241
  • 242
  • 243
  • 244
  • 245
  • 246
  • 247
  • 248
  • 249
  • 250
  • 251
  • 252
  • 253

U
sing H
elp
B
ack
204
Adobe After Effects Help
Creating User Interface Elements
U
sing H
elp
B
ack
204
cancelBtn:Button { text:’Cancel’, bounds:[235,15,335,35], \
properties:{name:’cancel’} } \
} \
}”;
dlg = new Window (alertBuilderResource);
The general structure of a window resource specification is a
Window
type specification (i.e., “dialog”),
followed by a set of braces enclosing one or more property definitions. Controls are defined as properties
within windows and other containers by specifying the classname of the control in a property definition, with
properties of the control enclosed in braces {}, for example:
testBtn: Button { text: ‘Test’ }
.
Creation properties
are specified in a
properties
property as named properties of an inline object (see example
above). The syntax of window resource specification strings is completely described below.
Window resource specification syntax
The window resource specification syntax is given in BNF (Backus-Naur Form) below:
resourceSpec
= ‘”’ windowTypeName inlineObject ‘”’
windowTypeName
= [a modal dialog]
inlineObject
= “{“ propertiesList “}”
propertiesList
= propertyDefn { “,” propertyDefn }
propertyDefn
= propertyName “:” propertyValue
propertyName
= [a JavaScript property name]
propertyValue
= “null” | “true” | “false” | string | number
| inlineArray |objectDefn
string
= [a JavaScript string literal]
number
= [any JavaScript integer or real number literal]
inlineArray
= “[“ propertyValue { “,” propertyValue } “]”
objectDefn
= ( namedObject | inlineObject )
namedObject
= [any object classname] inlineObject
Note
: To create a UI element, the classname in the namedObject definition above can be any element classname
referred to in “Types of interface elements” on page 197. For example:
“dialog { \
text: ‘From Resource’, bounds: [10, 10, 210, 110], \
box: Panel { \
bounds: [10, 10, 190, 90], \
ok: Button { \
text: ‘OK’, bounds:[40, 30, 140, 50], \
} \
} \
}”;
Interacting with controls: events and event callbacks
When a script creates a window, it typically adds control elements to the window that a user can manipulate,
for instance, by clicking a button, entering text in a text box, moving a scrollbar, etc.
These user actions or manipulations generate
events
within the user interface system. The script that creates a
window needs a way to be notified of events from that window or from controls within the window. The
scripting user interface provides a number of
event callback methods
that a script can define as properties of
any UI element that the script needs to interact with.