I often rearrange the system windows within my development environment, either inadvertently or as a temporary convenience. Because the new arrangement is saved in my resource file, when I restart VFP, I see the windows with their new size, position, and dock status rather than with my preferred defaults.
To get around this, I wrote the following code:
ACTIVATE WINDOW Document
ZOOM WINDOW "Document" NORM AT 1, 1 SIZE 40, 50
DOCK WINDOW Document POSITION 2
ACTIVATE WINDOW VIEW
ZOOM WINDOW "View" NORM AT 1, 1 SIZE 20, 50
DOCK WINDOW View POSITION 4 WINDOW Document
ACTIVATE WINDOW Properties
ZOOM WINDOW "Properties" NORM AT 1, 1 SIZE 20, 50
DOCK WINDOW Properties POSITION 4 window Document
ACTIVATE WINDOW Command
ZOOM WINDOW "Command" NORM AT 43, 1 SIZE 17, SCOLS()
DOCK WINDOW Command POSITION 3
To be able to run this code on demand, I used the Manage Environments dialog in the Task Pane. On the Environment Settings tab, I pasted the code into the "Run script after environment is set and project is loaded" box. I then created a shortcut to the environment (by right-clicking on the environment name and selecting "Copy shortcut"). This copied the following string to the clipboard:
vfps:doapplication?filename=(HOME() + "envmgr.app")
WITH "_1WF0P5KWK"
The value "_1WF0P5KWK" is a unique internally-generated key that the Environment Manager uses to recognize the shortcut.
Finally, I created the following keyboard macro:
{CTRL+F2}DO{SPACEBAR}(HOME()+"envmgr.app"){SPACEBAR}
WITH{SPACEBAR}"_1WF0P5KWK"{ENTER}
Now, whenever I want to restore the system windows to their default size, position, and dock status, I just hit the macro key.
-- Mike Penny, Ilminster, United Kingdom
A simpler approach would be to store the code in a PRG file, and to run that file directly from the keyboard macro. Alternatively, you could designate the code as a startup program, so that it runs whenever you launch VFP (to do so, enter the program's fully-qualified filename against "Startup Program" on the File Locations tab in the Options dialog).
But Mike's solution has two advantages: He doesn't need to keep track of a separate program file; and the windows are restored automatically whenever he loads the environment.
-- Mike Lewis, contributing editor