SaveEnvironment - cCJGrid
Saves the grid layout information
Type: Procedure
Syntax
Procedure SaveEnvironment
Call Example
Send SaveEnvironment
Description
SaveEnvironment saves the grid object's layout information. This is used to restore a user's grid column configuration the next time the grid is activated and the next time the application is loaded. SaveEnvironment is called when a grid object is deactivated.
By default, SaveEnvironment does the following:
- It saves the current grid layout as a temporary instance. If the grid is activated again, this layout instance will be applied. This means that a grid's layout is always preserved during a single run of the application.
The remaining steps are applied to optionally save the grid layout so it can be used the next time the application is run.
-
If a cApplication object does not exist or that application object's pbPreserveEnvironment property is false, it returns and does nothing.
-
If the grid object's pbRestoreLayout property is false, it returns and does nothing
-
It determines the registry key. It does this by getting cApplication object's RegistryKeyString function and appending the grid's psLayoutSection property value. The registry key will be RegistryKeyString + psLayoutSection + "\Grid". If psLayoutSection is blank, an error is raised.
-
If saves the layout by calling the private message SaveGridLayoutToRegistry passing the registry key.
When the application is run again, the grid's layout is restored by calling LoadEnvironment, which is called as part of the grid's activation process.