4D v14.3

Memorization of window geometry

Home

 
4D v14.3
Memorization of window geometry

Memorization of window geometry  


 

 

4D includes automatic features that save the specific appearance of windows when they are closed (their "geometry"), allowing users to find their working environment in the same state that they left it. 

These automatic features concern the window coordinates and the position of the different objects it contains, as well as the current state of certain objects such as Tab Controls.

Note: The automatic features are only supported if forms are reopened with the same size they had when they were closed. Consequently, they are based primarily on the use of the Open form window  command with the * parameter.

To enable the automatic memorization mechanism, you must check the Save Geometry option found in the Form properties

When this option is checked, several form parameters are automatically saved by 4D when the window is closed, regardless of how they were modified during the session:

  • the current page,
  • the position, size and visibility of each form object (including the size and visibility of list box columns).

Note: This option does not take into account objects generated using the OBJECT DUPLICATE command. In order for a user to recover their environment when using this command, the developer must repeat the sequence of creation, definition and positioning of the objects. 

When this option is checked, the Save Value option is also available for some objects (see below).

The Save Value option is found in the "Objects" theme of the Property List:

This option is available when:

  • the Save Geometry form option is checked for the form,
  • the selected object contributes to the overall geometry of the form. For example, this option is available for check boxes because their value can be used to hide or display additional areas in the window (see examples below).

Here is the list of objects whose "value" can be saved:

ObjectSaved value
Radio buttonValue of associated variable (1, 0, True or False for buttons according to their type)
3D radio buttonValue of associated variable (0, 1)
Check boxValue of associated variable (0, 1, 2)
3D check boxValue of associated variable (0, 1)
TabsNumber of selected tab
Pop-up/Drop-down listNumber of selected row
Picture pop-up menuNumber of selected row

4D keeps the coordinates of windows when they are closed as well as their maximized state under Windows when they were generated using the Open form window (formName; *) statement.

This information, as well as that which can be saved optionally (geometry and value) is saved in json format in the current user folder of the machine, when the window is closed. Thanks to this, even when the "Default user" account is used, each user that connects with their own machine can keep their own environment. 

This information is then only used if the form is reopened with the same dimensions and when closing. This means that either the Open form window(*) statement was used, or that the developer has set up a custom system for saving coordinates.

The information saved is restored and reapplied in the following order:

  • the size and position of the window are restored when the Open form window command is executed
  • the values of the variables are restored when the form is loaded before calling the On Load event
  • the current page is restored before calling the On Load event
  • the position, size and visibility of each object are restored just after the On Load event.

The properties of subform objects are saved and automatically reapplied in the same manner. 

Warning: Information saved using the "Save Geometry" and "Save Value" options is reset whenever the objects of a form are modified in Design mode (resized, moved, added, deleted or renamed). Consequently, we strongly recommend that you do NOT use this interface functionality for saving permanent values such as user preferences.

You want for the relative positions of the form separators to be saved. In this case, you can just check the Save Geometry option. When the form is opened, it looks like this:

The user resizes the window and moves the separators. The objects are resized according to their own properties. Then the user closes the window.
When the form is opened again, the objects retain their new look:

In a form, you have placed one or more expandable areas managed using 3D check boxes. Each check box displays a triangle pointing to the right when the area is collapsed, and pointing downwards when it is expanded. There are several ways to set up these areas (movement or visibility of objects, using different form pages, etc.), and in all cases, the size of the window can vary.

In order for the state of the expandable areas to be preserved between two sessions, you must:

  • check the Save Geometry option for the form so that the current page, positions and visibility statuses of its objects are kept,
  • check the Save Value option for the 3D check box object so that the value of its associated variable is kept (0 or 1 for collapsed or expanded state).

In a form, you have put tabs with the "Goto Page" standard action:

In this case, for the memorization mechanism to work properly, you must check the Save Geometry option for the form and the Save Value option for the tab object:

 
PROPERTIES 

Product: 4D
Theme: Properties for active objects

 
ARTICLE USAGE

4D Design Reference ( 4D v14 R2)
4D Design Reference ( 4D v14 R3)
4D Design Reference ( 4D v14.3)
4D Design Reference ( 4D v14 R4)