Form Controls

The various types of control that can be embedded into a form are listed below. Note that the data control (Field, Memo, ...) are not available in a Menu (null) block.

Field

A field is a simple one-line text entry control. You can set various properties such as font and colour.

Normally, a field is implemented as a QT line edit control, but fields can be morphed, that is, when input focus is not in the field then it is handled directly by Rekall. This is provided mostly for use in table data views where there are a large number of columns (and hence fields) displayed at the same time, whence morphing makes screen update much faster.

Memo

A memo is a multi-line edit control. In the current release of Rekall it does not do anything clever like word wrapping. Note that when in a memo control, tab insertes a tab character, rather than moving focus to the next control.

Choice

A choice control is a combo-box which displays a defined set of options (stored as one of the properties of the combo-box).

Choice controls can be morphed, like field controls; when input focus is not in the choice control, then it displays as simple text. This can be useful if space is limited, since the combobox drop-down arrow does not usually display.

Link

A link control is also a combo-box, but rather than have a defined set of options, it displays values from another table (or a Rekall query or SQL query). You specify a target table and a column in the target table containing values that are stored in the table or query to which the link control refers, and an expression based on columns in the target table; the expressions are displayed as the options in the combo-box.

For instance, suppose you want to store a person's title (for instance, Mr, Mrs, and so forth), but that you are not sure in advance that you know all possible titles. So, you create a Title table that has two columns, one a primary key and the other the title. Then, in say a Client table, there is a title column which stores primary key values from the Title table. In a form you then use a link control which matches the Client.title column to the primary key in the Title table, and displays the title text.

This has the advantage that to add a new title, you just add a new entry to the Title table. Indeed, by changing the title text in the Title table, you could change all the titles from, say, English to German.

Link controls can be morphed exactly as choice controls.

A link control can show more than one column of information from the target table. For instance, if the display expression is set to col1, col2, col3 then the link control will show three columns of information, respectively col1, col2 and col3 from the target table (or query). This can be useful if you want the user to see more information about the linked record that they are selecting. By default, all columns are shown both in the control itself and in the drop-down. However, the number of columns shown in the control itself can be limited by setting the Show Columns property to a non-zero number.

Tree

A tree control is like a link control, except that the linked data can be displayed as a tree.

The important addition is the tree grouping settings, which controls how the data in the tree is grouped up. Suppose for instance you had a table containing data about types of car. The table contains columns giving the make (Ford, Rolls-Royce, ....), makes (Fiesta, ..., Corniche, ...) and variants (1.1LX, 1.4 Flight, ...), and you want the user to be able to select a particular varient. The natural way to display this is as a tree; the top level shows makes, then next level the models, and at the bottom the variants.

Setting the tree grouping to make, model (assuming those are the column names) provides the required grouping. The display expression is then set to make, model, variant to display the appropriate values. The number of items in the display expression should always be at least one greater than in the tree grouping.

Pixmap

A pixmap control can display an image. Rekall knows about a reasonable selection of image types ( Actually, this depends on the image types which the QT library supports, but will probably include bmp (Windows bitmap), gif, jpg/jpeg (Joint Photographic Group), pbm (Portable bitmap), pgm, png (Portable Network bitmap), ppm, xbm (X bitmap) and xpm. )

The Automatic Resize settings controls how the image is mapped onto the control. There are four possible setings. No scaling means that the image is copied unchanged to the form, and will be clipped if it is too large for the space allocated to the control. Exact fit causes the image to be scaled (stretched or shrunk) to exactly fit the allocated space; this will mean that the image is distorted if the image and control aspect ratios are different. Fit preserving aspect ratio stretches or shrinks the image until it is completely visible within the control, but does not distort it (so the entire space of the control may not be occupied). Lastly, Fill preserving aspect ratio stretches or shrinks the image, again without distortion, such that the entire control is filled; consequently the image may be clipped.

Graphic

This is like a pixmap, except that the control shows a fixed image, so it can be used, for instance, to display a logo. Selecting the Image properties allows images to be imported into the Rekall database; they are stored either in the objects table or in the file system (according as whether the form is stored in the objects table or file system). You can then select an image from those that have been imported.

The control has an Automatic Resize property which functions exactly for the pixmap control.

Check

A check is a simple yes/no checkbox. Note that the checkbox itself does not include a label (unlike the underlying QT checkbox control), so in the illustration below, the label is a separate object.

Spin Box

This control shows a numerical value in a control which has two small buttons that the user can click to increment or decrement the value.

Rich Text

This control is displayed using the QTextBrowser widget provided by the QT toolkit. It is mainly included for future use in Rekall itself, to display help information and the like. Text to be displayed in this type of control should be formatted as QT Rich Text (see Troll Techs documentation for details), which is basically a very much stripped down HTML.

From Rekall 2.4.4, the rich text control is editable. By default it is set to read-only (for backward compatability), but if the Read Only property is explicitely cleared (rather than being left unset) then text can be updated. You can also set a number of basic formatting options. The Tool Bar Icons property allows a number of editing tools to be selected and displayed in a toolbar (the toolbar is displayed if any formatting option is selected). The control keys Ctrl-B, Ctrl-I and Ctrl-U are shortcuts for bold, italic and underline respectively.

Row Mark

Rowmarks do not display actual database data. Rather, they are used as a per-row marker, and show icons to indicate the current record and whether the record has changed. In addition, they can be set to show a row number.

Label

This is a text label. Label text can be formatted as QT rich text, for instance the illustration below shows the text underlined. The text is fixed except that it can be changed from a script.

Button

A button is a standard button control. For it to do anything it needs to invoke a script, although there are the shortcuts like #Click described in a previous chapter to handle simple operations.

Tab Control

A tab control is a container object which can contain one or more pages, each of which is associated with a named tab. Once you have created a tab control, you can add pages; the pages themselves are in effect containers, into which other controls can be placed.

All data controls in all pages of a tab control are in effect embedded in the block into which the tab control itself is embedded. So, for instance, if the block takes data from a table which has a large number of columns, you can use a tab control to show different sets of columns under different tabs.

Container

As well as the tab control, a form can also embed a simple container object. There are two main uses for this.

Firstly, if you wanted some control to appear in an area of the form which has a different background colour, or perhaps shows as a raised or sunken panel, you can create a container. The container is given the required colour or effect, and the controls placed into the container. The main menu form of the RekallDemo database uses this technique for the bottom-right area (the other three areas are actually menu-only blocks, but the effect is the same in this situation).

Secondly, if you have a form which has the property of being Stretchable, then you can use a container with suitable X-mode and Y-mode stretch properties to get various resizing effects.