Static layout is simple and easy to use, and the ability to make controls stretch or float provides a resizing mechanism which handles many cases. However, while this sort of layout is fine if you know things like which font the user will be using, it can cause problems, For instance, if you design assuming that the user will be using a 12pt font, but the user changes to 16pt, then controls will typically be too small. Not only may they not be long enough, they may not be high enough either!
Dynamic layouts provide a way to get around this problem. When using a dynamic layout, controls will automatically size themselves appropriately; typically, this depends on the control itself and the font size. The overall layout of the form, and the size of the window that the form occupies, will adjust so allow for the changes in control size. Over and above this, you can also specify setting such as minimum and maximum sizes.
For those who are interested, this mechanism is built on top of the layout mechanism provided by QT, the toolkit on which Rekall is built. QT actually provides rather more flexibility than is made available by Rekall, but you should be able to handle most situations.
Please note that (as of Rekall 2.3.3) dynamic layouts do not work with forms (or blocks within forms) that show multiple database records at the same time (ie., the block rowcount setting is anything other than one). This will be fixed in a later release.
Dynamic Layout GridsAlthough it is possible to nest dynamic layout blocks within static layout blocks, and vice versa, this is not usually a useful thing to do, so this description assumes that all blocks from the top-level form block downwards are dynamic.
To create a dynamic form, select the dynamic option on the second page of the form setup wizard which appears when you start to create a new form. When you reach the block properties dialog, you will find that the geometry property will be set to (x,y) Dynamic: 2*2 where x and y are the initial sizes of the form. Dynamic indicates the the block is indeed using dynamic layout, and 2*2 indicates an initial two-by-two grid.
Dynamic layout blocks are always treated as a rectangular grid of cells. The initial default is two rows and two columns, but there are two ways of changing this. From the block properties dialog, open the geometry property. This will show a dropdown via which the management can be changed, plus settings for the numbers of rows and columns; changing these will add (or remove) columns at the right, and rows at the bottom.
The other way to change the grid size is to right-click in the dynamic block, and select the dynamic layout entry from the pop-up menu. This in turn presents a number of options, including items to insert or delete a row or column. Deletion applies to the row or column in which the mouse was clicked; insertion inserts above the row or to the left of the column (so, to add a row use the popup menu unless you want to add a row below the current rows, in which case you need to use the property dialog). Note that, in order to avoid accidents, deletion can only occur when all the cells in the row or column are empty!
Each cell in a grid can either be empty, or can contain a single control or nested block or container. Nesting containers allows you to build up control layouts that do not appear, to the user, to be simple grids.
Dynamic Layout SettingsThere are a number of settings that you can use to fine-tune a dynamic layout.
A control (or nested block or container) which is embedded in a dynamic layout has a number settings which are found in the property dialog for the control, under the geometry property. These are listed below (where control also applies to nested blocks and containers):
Setting | Significance |
Horizontal | If the control does not use the entire width of its cell, this setting specifies how the control is horizontally aligned in the cell. |
Vertical | As above, for vertical alignement. |
Min Width | Sets a minimum width (in pixels, but see below) on the control |
Max Width | Similarly for maximum width. |
Min Height | Similarly for minimum height. |
Max Height | Similarly for maximum height. |
Size by characters | If this option is checked then the above minimum and maximum settings are interpreted as character spacings rather than pixels, for the font used. Note that in the case of variable width fonts, the width is approximate for typical characters widths. |
The other grid settings are accessed from the same popup-menu as used for row and column insertion or deletion, via the grid setup entry. This shows two combo boxes that can be used to specify a particular rows or columns. For each row and and for each column, you can specify two values, spacing and stretch. Spacing is actually the minimum row height (or column width); stretch controls how the rows (or columns) stretch relative to each other as the form is resized. For instance, if you have two colums with stretch settings of zero and one, then the first column will never change size, and the second will get all extra width as the form is resized. The form layout will change as you change the settings; if you click Cancel then the original settings will be restored.