Understanding Picture Events
Each picture you create executes events when you open or close it. By writing a script for each event's handler, you can automatically complete specific task (such as initialization of variables) when a picture opens or closes.
The events that a picture executes vary depending on the WorkSpace environment. The following tables summarize the picture events the occur.
When you open a picture in the... |
The following events occur... |
Configuration environment |
InitializeConfigure |
Run-time environment |
1. Initialize 2. Activated |
When you close a picture in the... | The following events occur... |
Configuration environment | N/A |
Run-time | Close |
If you open a picture with an OpenPicture subroutine, the open events (Initialize and Activated) execute immediately. However, if the OpenPicture call is inside looping or branching structure (such as a FOR loop or an IF statement) then the open events do not fire until the OpenPicture script completes.
Conversely, if you close a picture with a ClosePicture subroutine, the Close event of the picture being closed never fires because the picture is removed from memory before its script has a chance to run.
Pictures also execute Activated and Deactivated events as you switch from one picture to another. The Activated event occurs whenever of picture gains focus. The Deactivated event executes when a picture loses focus. For example, suppose you have two pictures open and the first picture, Picture1, has focus. When you select the second picture, Picture2, Picture1 executes the Deactivated event and Picture2 executes the Activated event. When you switch back, Picture2 executes the Deactivated event and Picture1 executes the Activated event.