How to Use the ProMatrix Grid Builder

The following steps show you how to use the ProMatrix Grid Builder to build editable grids based on the Grid_Toolbar class. VPM Enterprise editable grids use the VPM Enterprise toolbar controls, and therefore, they must be used on forms based on the Form_Toolbar class or a subclass thereof.

1. New Form Dialog, Change the Form Class and Set Up the Data Environment and Form Properties

First, complete the same basic steps 1, 2 and 3 required to create a form with the ProMatrix Basic Form Builder. See ProMatrix Basic Form Builder.

These steps involve:

·       Selecting whether to start with (a) a blank form based on a form class that you specify, (b) a blank form based on the default form class template  or (c) a copy of an existing form.

·       Changing the form class to the class you want in the Form Designer if it is not already selected.

Important: Use the Form_Toolbar class or a subclass thereof.

·       Setting up the data environment and form properties for your form.

Important: When you set up the data environment, set the BufferModeOverride property to 5 (optimistic table buffering) for the InitialSelectedAlias table, view or CursorAdapter.

2. Add a Grid_Toolbar Grid to the Form

1.   In the Visual FoxPro Form Designer, display the controls from the VPMCTRLS.VCX, DEVCTRLS.VCX or PROCTRLS.VCX class library on the Form Controls Toolbar.

2.   Click the Grid_Toolbar control on the Form Controls Toolbar and click your form to drop the grid on the form.

3.   Size the form and grid as desired. (You can always resize later.)

3. Run the ProMatrix Grid Builder

1.   Right click on the grid and select Builder from the popup menu. VPM Enterprise displays the Builder Selection dialog.


2.   Select ProMatrix Grid Builder from the Builder Selection dialog. VPM Enterprise displays the ProMatrix Grid Builder.


3.   On the ProMatrix Grid Builder enter/select the following items:

·       Form Name: Enter a unique name not used on any other form in the application. (If you are adding an additional grid to a form, you have probably already done this, and the form name you selected previously will be displayed in the Form Name field.)

·       Form Caption: Enter the caption that you want to display in the form's title bar. (If you are adding an additional grid to a form, you have probably already done this, and the form caption you selected previously will be displayed in the Form Caption field.)

·       Select Fields: The ProMatrix Grid Builder shows the fields from all of the tables, views and CursorAdapters you have added to the Data Environment. The table, view or CursorAdapter alias is shown with the fields. Move the fields you want in the grid from the Unselected Fields list to the Selected Fields list.

·       Order Fields: The fields in the Selected Fields list will be placed in the grid in the order in which they are listed. Therefore, change the order of the fields so that the order meets your specifications.

4.   Selected Field Properties: When you highlight a field in the Selected Fields list, the Selected Field Properties box shows:

·       Caption: The field Description (Short) property entry from the Data Builder. The Grid Builder will put the Caption in the field’s grid Header Caption property.

Tip: After the grid is built, you can change a header caption on a grid column to something other than the field Description (Short) entry in the Data Builder. To do this, select the Header object in the Property window and change it's Caption property to the text you want. Then, set the lGridOverrideCaption property of the field’s control in the grid to .T. (true).

Tip: If you want to override the Data Builder field Description (Short) entries of all fields in the grid, set the grid’s lGridOverrideCaption property to .T. Then, enter the header captions you want in each field’s Header Caption property.

·       Control Type: The default VPM Enterprise control class that will be used for the field in the grid. You can change the control class via this Control Type combo box. For example, by default VPM Enterprise puts a numeric field on a grid using the TextBox class. You can change the class to the Spinner class through the Control Type combo box.

Tip – Picklist Help: If a field is a foreign key using Referential or Set validation, choose a VPME textbox or combobox control for the field and later set up the control properties to get the Picklist behavior you want.

·       Read-Only: If you want to make the field’s grid column read-only, check this box.

Tip: Select this property for any fields that are not from the InitialSelectedAlias cursor.

5.   Calculated Fields: The ProMatrix Grid Builder allows you to easily create calculated fields for a grid. To create a calculated field for a grid column:

·       Click the Calc button at the bottom of the column of buttons on the Grid Builder. The Grid Builder displays the Visual FoxPro Expression Builder.

·       Create your calculation expression in the Expression Builder. When you close the Expression Builder, the calculation expression will be added to the Selected Fields list with the prefix “Calc:”.

·       Set up the Selected Field Properties for the calculated field as described in step 4 above.

·       You can edit a calculated field by selecting the field in the Selected Fields list and clicking the Calc button.

6.   Grid Source Table: The InitialSelectedAlias table, view or CursorAdapter should be automatically selected in the Grid Source Table combo box at the bottom of the Grid Builder. The ISA table, view or CursorAdapter must be selected for an editable grid. Be sure it is.

4. Build Grid

After you have set up the grid as you want it, click the Build Grid button. The ProMatrix Grid Builder will build the grid for you.

5. Clean Up

After the ProMatrix Grid Builder creates the grid, you will want to clean it up. In particular, you will need to resize the grid columns if the grid column header is much longer than the field displayed in the column.

6. Complete Standard Form Tasks

1.   Run the ProMatrix Toolbar List Builder: Run the ProMatrix Toolbar List Builder to create a customized toolbar List control grid for the form. See ProMatrix Toolbar List Builder.

2.   Run the ProMatrix Condition Field List Builder: Run the ProMatrix Condition Field List Builder to select the fields that will appear in the form’s Condition Builder Field list. See ProMatrix Condition Field List Builder.

3.   Set the Tab Order: Set the tab order of the form through the Tab Order option on the View menu.


Editable Grid as Child Related Form