Displaying the contents of the auxiliary window
The auxiliary window systematically runs the "initializePropertiesBox" method within the given profile, when "addPropertiesPage" service is called. This method is called on the element selected in the explorer or in a graphic editor, and has the following syntax:
initializePropertiesBox(inout PBoxDescription box)
This method's code is usually the following:
PBoxMatrix matrix;
// the matrix is the equivalent of beginLayoutSection
on JBoxes
sessionBegin("My properties page initialization",
true);
// persistent session
matrix = box.createMatrix("");
// creation of a matrix
initMatrix(box, matrix);
// initialization of the matrix, see further on for
details
box.setItem(matrix);
// affectation of the matrix to the editor
sessionEnd();
// end of a session
In this case, we are going to start by creating a matrix, using the "createMatrix" method.
All the work is delegated to the
"initMatrix" method, which will be defined on all the metaclasses for
which we require a different display.
Its syntax is usually the following:
void initMatrix(inout PBoxDescription box,
inout PBoxMatrix matrix)
The last step is to affect the newly-created matrix to the auxiliary window, using the "setItem" method. Since the auxiliary window itself can only contain one single item, a matrix containing all the elements to be displayed is always affected to it.
Example of the contents of the "initMatrix" method
void Class:initMatrix(inout PBoxDescription box,
inout PBoxMatrix matrix)
{
PBoxItem item; // items to be added to the matrix
// Addition of a label
item = box.createGraphicLabel("My_label");
matrix.pushInto(0, matrix.NbRows(), item);
// Addition of a group of radio buttons
item = box.createGadgetChoice
(this,"Persistence", "label_Persistence");
item.setRadio(true);
// true => radio buttons, false ==> combo box
item.appendLabel("label_Transient");
item.appendLabel("label_Persistent");
item.appendLabel("label_Undefined");
// Addition of the item at the bottom of the matrix
matrix.pushInto(0, matrix.NbRows(), item);
// Addition of the management of a tagged value type
item = box.createEditTag
(this,"sqlName","label_SQL_Name");
matrix.pushInto(0, matrix.NbRows(), item);
// Addition of a tickbox
item = box.createGadgetToggle(this,"Null","Not null");
matrix.pushInto(0, matrix.NbRows(), item);
// Addition of a simple text field
item = box.createEditField
(this,"TypeConstraint","String_size");
matrix.pushInto(0, matrix.NbRows(), item);
// Addition of a multi-line text field
item = box.createEditText
(this,"Check","Check_constraint");
matrix.pushInto(0, matrix.NbRows(), item);
}