6.3.15 Adding Controls to the Current Layer
As with previous frames, a formLayout must be created first:
// Form layout
string $form4 = `formLayout ewc_formCurrentControls`;
Scroll down a few comments and add the command to close the
// Close the scope of the form layout
setParent ..;
// Close the scope of the Current Layer frame
Only three controls will be created: a text control and two buttons.
The text control will be used in section 6.4 to hold the name of the
current layer in a scene.
// Text control to display name of current layer
string $txt2 = `text -label "Current: " ewc_txtCurrentLayer`;
Chapter 6
Figure 6-42:
// Assign button to assign the highlighted layer as current
string $btn22 = `button
-label "Set Current"
-command ""
-enable 0
-width 75
// Reset button to set defaultLayer as current
string $btn23 = `button
-label "Reset Default"
-command ""
-width 75
Edit the position of the controls:
// Edit layout for Current Layer frame
formLayout -edit
// text label for displaying current layer
-af $txt2 "top" 2
-af $txt2 "left" 5
-af $txt2 "bottom" 2
// set current layer button
-af $btn22 "top" 2
-af $btn22 "left" 150
-af $btn22 "bottom" 5
// reset current layer button
-af $btn23 "top" 2
-ac $btn23 "left" 5 $btn22
-af $btn23 "bottom" 5
The Reset Default button is enabled (unlike most of the controls)
because no highlighted item is required in either of the text lists to
reset to the defaultLayer (this layer exists by default in all scenes).
Scene Management with ewc_extendedLayerManager
Chapter 6

Get Professional MEL Solutions for Production now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.