A matrix box is a composite control that can show information
from several tables at the same time. The first two tables are the
vertical and the horizontal table of the matrix box control. In the
matrix part of the control, each cell can be used to display
information that is calculated on the basis of fields in these two
tables, or information that is retrieved from other tables (with
values from the first two tables being used to select records, for
example by setting filters). Each cell in the matrix is the
intersection of a record from the vertical and the horizontal
table.
The part to the left of the vertical divider bar displays
records from the vertical table, the table that is the source table
of the form, similar to a table box. To the right of the divider
bar is the matrix itself. Above it, the records from the horizontal
table are displayed (in the style that is normally used for the
labels in a table box). This is the matrix heading. The horizontal
table is called the matrix source table.
Note |
Matrix box controls are not supported in the RoleTailored
client.
|
The following illustration shows a matrix box control on Form
113, Budget.
Navigating in a Matrix Box
Navigating in a matrix box is more complex, since there are
several tables and dimensions involved. The following describes how
to navigate by using the mouse and by using the keyboard.
Using the Mouse
You can scroll the vertical table vertically by clicking the
navigation buttons to the right of the matrix. You can scroll the
horizontal table horizontally by clicking the navigation buttons at
the bottom of the matrix. If all columns of the vertical table do
not fit in the "table box", a normal scroll bar will be added, and
you can scroll the columns horizontally, similar to a table
box.
You can resize any column by placing the cursor in the label
area and then dragging when the cursor changes to the resize cursor
(which it does when it is on top of a column divider). Dragging the
vertical divider bar changes the relative proportions of the table
box and matrix box parts.
The height of the headings, both in the table box and the matrix
part of the control, can be adjusted by dragging. The columns in
the table box part can be resized vertically.
Using the Keyboard
To use the keyboard for navigation, you will have to place the
focus in the part of the control that you want your keystrokes to
affect.
You can move from one part of the control to another by pressing
CTRL+<arrow key>. The following table shows how to move from
one part of the control to another.
Keyboard shortcut |
Description |
CTRL+RIGHT ARROW
|
Move from the table box to the matrix
|
CTRL+UP ARROW
|
Move from the matrix to the matrix heading
|
CTRL+DOWN ARROW
|
Move from the matrix heading back to the matrix
|
CTRL+LEFT ARROW
|
Move from the matrix to the table box
|
You cannot go directly from the matrix heading to the table box
(you have to go via the matrix).
When the focus is in the matrix heading, use PAGE UP and PAGE
DOWN to scroll the horizontal table (that is, a horizontal
scroll).
CTRL+PAGE UP or CTRL+PAGE DOWN in the matrix part (including the
matrix heading) will also scroll the horizontal table.
Creating a Matrix Box
The following procedure describes how to create a matrix box in
which both the vertical and the horizontal tables are based on the
Integer table and the matrix cells display the product of the two
integers in the records that intersect at that cell.
To create a matrix box
-
Create a new form, and select the Integer table as the source
table.
-
Add a matrix box to the form. Give the matrix box control a name
by setting the Name
Property. Set the HorzGlue
Property and VertGlue
Property to Both.
-
Insert a text box with the Number field from the Integer record
as the source expression in the table part of the matrix box.
-
In the property sheet of the matrix box control, select Integer
as the MatrixSourceTable
Property.
-
Add a text box without a source expression to the empty part of
the matrix box control. Verify that the InMatrix
Property of this text box is Yes.
-
Add a text box without a source expression to the last empty
part (the matrix heading) of the matrix box control. Verify that
the InMatrixHeading
Property of this text box is Yes.
-
Add a source expression to the text box in the matrix heading,
which you added in Step 6. The source expression should point
to a field from the MatrixSourceTable. The following example of a
source expression is for a matrix box named Matrix in which the
horizontal table is the Integer table:
|
Copy Code |
CurrForm.Matrix.MatrixRec.Number
|
-
Add a source expression to the text box in the matrix. The
following example of a source expression will display the product
of two integers:
|
Copy Code |
Number * CurrForm.Matrix.MatrixRec.Number
|
Programming Information
To access the horizontal table (the matrix source table), you
must give the matrix box control a name by setting the Name
property of the control.
When the matrix box control has a name, the records of the table
can be accessed by using the following:
|
Copy Code |
CurrForm.<name of matrix box control>.MatrixRec.<field>
|
Triggers
A matrix box control has the following triggers:
Properties
A matrix box has the following properties:
The following text box properties are special for text boxes
that are part of a matrix box control:
Areas
-
(% MAT_VERT "Vertical table") This area
contains records from the vertical table. The vertical table is the
table that is the source table of the form.
-
(% MAT_HORZ "Horizontal table") This area
contains records from the horizontal table. The horizontal table is
the table that is the matrix source table. This area is also known
as the matrix heading.
-
(% MAT_MAT "Matrix") This area is the matrix
itself. Each cell is at the intersection of a record from the
vertical table and one from the horizontal table.
-
(% MAT_NV "Vertical navigation") Use the
navigation buttons in this area to scroll the vertical table.
-
(% MAT_NH "Horizontal navigation") Use the
navigation buttons in this area to scroll the horizontal table.
-
(% MAT_SCROLL "Scroll bar") Use this scroll bar
to see other records from the vertical table.
See Also