Managing field positioning using matrices

 

A matrix is a zone broken down into lines and columns, and functions a little like an Excel spreadsheet.  Items are positioned and aligned in one of the matrix cells.

 

A matrix is created using the following method:

 

PBoxMatrix PBoxDescription:createMatrix

          (in String title);

This method creates a matrix zone, "PBoxMatrix", in which graphic gadgets are positioned.

 

 

The following service is used to position an item in a cell:

 

PBoxMatrix:pushInto(in integer column,

                      in integer row,

                      inout PBoxItem item);

Column and line numbers start at zero.  A cell can only contain one item.

 

 

The "NbRows()" and "NbColumns()" methods are used to find out the current number of lines and columns in the matrix.  If you run:

 

matrix.pushInto(0, matrix.NbRows(), item);

the item is automatically placed on the first free line of the matrix, in the first column.

 

 

The main matrix must be affected to the auxiliary window, using the following method:

 

PBoxDescription:setItem(inout PBoxItem mainItem);

This method is used to associate a specific item to the auxiliary window.  There can be only one item, which is why a matrix is always affected to the auxiliary window.

 

Note:      For an overview of the "PBoxDescription" and "PBoxMatrix" metaclasses, please see "Overview of auxiliary window services".