Skip to content

peRestoreLayout - cCJCommandBarSystem

Determines how menubar / toolbar layouts are saved and restored

Type: Property
Access: Read/Write
Data Type: Integer
Parameters: None

Syntax

Property Integer peRestoreLayout
Access Type Syntax
Read Access: Get peRestoreLayout to IntegerVariable
Write Access: Set peRestoreLayout to IntegerVariable/Value

Description

peRestoreLayout determines how menubar / toolbar layouts are saved and restored.

Possible values are:

Constant Meaning
rlNoSaveRestore Does not save or restore the layout
rlSaveRestoreLayout Saves and restores the position of toolbars and menubars
rlSaveRestoreFullLayout Saves and restores the position of toolbars and menusbars and any changes to the command bar's appearance such as theme and text below icons. Does not save menu item customizations
rlSaveRestoreAll Saves and restores the full layout including any menu customizations

Default is rlNoSaveRestore

The automatic save and restore behavior is only designed to work with the main MDI menu system in your project. When using menus, toolbars and statusbars in other parts of your application, you should set peRestoreLayout to rlNoSaveRestore.

If there is no application object (cApplication) or it the application object's pbPreserveEnvironment is false, the save and restore process is ignored.

When a command bar system is created or destroyed, the messages LoadEnvironment and SaveEnvironment are sent to the object. If the above conditions are met, the command bar data will be saved to and loaded from the registry based on the setting of this property. Note that SaveEnviornment and LoadEnvironment can be augmented to load and save to an XML file.

rlSaveRestoreAll should only be used if end user menu customization is allowed (pbEnableCustomization).

Detecting Changes in Source Layout

When source code changes are made in a command bar system, the restored layout may interfere with those changes. When this happens, changes made to the command bar system will not appear because the old settings are being restored. The command bar system attempts to recognize when such a change has occurred by checking if the number of toolbars and items have changed. If it has, the previous setting will not be restored. In some cases, it will not recognize that a change has actually occurred. If this happens, you must tell the system that the menu layout has changed. You can do this by changing (i.e., incrementing) the build number of the command bars by setting the piLayoutBuild property.