The following steps show you how to use the ProMatrix List Builder to build toolbar List grids for forms based on the form_toolbar class or one of its subclasses.
1. Set Up the Data Environment
At anytime after you have set up the Data Environment for a form, you can use the List Builder to create the form’s toolbar List grid. Generally, you need to complete the following basic steps to create a form before running the List Builder:
· Form Class: Select the form class you want in the Form Designer.
Important: Use the Form_Toolbar class or a subclass thereof.
· Form Name: Enter a unique form name in the form’s Name property through the Properties window or through one of the VPME Form Builders.
· Data Environment & Form Properties: Set up the data environment for your form and set required Data Environment and form properties.
2. Run the ProMatrix Toolbar List Builder
1. Right click on the Form Designer and select Builder from the popup menu.
2. Select ProMatrix Toolbar List Builder from the Builder Selection dialog. VPM Enterprise displays the ProMatrix List Builder.
3. On the ProMatrix List Builder enter/select the following items:
· Select Fields: The ProMatrix Toolbar List Builder shows the fields from the InitialSelectedAlias table, view or CursorAdapter. Move the fields you want in the grid from the Unselected Fields list to the Selected Fields list.
Maximum Number of Fields: You can select up to 15 fields.
· 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.
Tip – Initial List Order: When the Toolbar List grid is first displayed, its order is set to the order of the first sortable column. Therefore, be sure to make the first sortable field in the Selected Fields list the field that should determine the initial List order.
View and CursorAdapter Note: The Order Tag combo box is disabled for a view or CursorAdapter. For a view or CursorAdapter, Incremental Search tags are created at runtime if Case Sensitive or Not Case Sensitive is chosen for a field.
4. Selected Field Properties: When you highlight a field in the Selected Fields list, the Selected Field Properties box shows:
· Caption: This is the field Description (Short) property entry from the Data Builder. The List Builder will make the Caption the header caption for the grid column that contains the field.
· Order Tag: If you want to make the field’s grid column sortable, select a tag for the field in the Order Tag combo box.
5. Incremental Search: If you want to provide incremental search for a field, first select an Order Tag for the field. Then, select the Case Sensitive or Not Case Sensitive option button.
6. Case Sensitive: Selecting the Case Sensitive option button makes the incremental search case sensitive.
7. Not Case Sensitive: Selecting the Not Case Sensitive option button makes the incremental search not case sensitive if you also do one of the following when the InitialSelectedAlias is a table:
· Alternative 1 - Create Upper Index Tag: Create an index tag for the field that uses the UPPER function in the index expression to force the tag to upper case. Select this tag as the Order Tag. (Not necessary for views or CursorAdapters.)
· Alternative 2 - Upper Field Format Property: Enter a Format property for the field in the Data Builder that uses the “!” symbol to force entry into the field on a form to upper case. If you do this, the Order Tag you select for the field does not have to use the UPPER function. (Not necessary for views or CursorAdapters.)
Warning: Do not use Alternative 2 if the data in the field already contains mixed or lower case entries.
8. Calculated Fields: The ProMatrix List Builder allows you to easily create calculated fields for a List grid. To create a calculated field for a grid column:
· Click the Calc button at the bottom of the column of buttons on the List Builder. The List 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 3 above.
· You can edit a calculated field by selecting the field in the Selected Fields list and clicking the Calc button.
9. Records Displayed: Select the number of records to display when the List grid appears. If you leave the records displayed field set to zero, by default the List grid displays 10 records. The List form is resizable and users can change the number of records displayed after the List form appears.
10. Max. Form Width: Select the maximum List form width in pixels. If you leave the maximum form width field set to zero, by default the List form automatically sizes itself to fit the fields you select for the List grid. Normally, you will want to leave the maximum form width at zero. However, if you select more fields for the List grid than can be displayed on the desktop, you may want to enter a value for the maximum form width.
If you select more fields than can be displayed on the desktop screen, the List form automatically leaves a 20 pixel left and right margin. At low resolutions the List form may become unacceptably wide if the List grid contains more columns than can be displayed on the screen. In this case, you may want to set a maximum List form width that matches its associated form’s width in pixels.
3. Build Grid
After you have set up the List grid as you want it, click the OK button. The ProMatrix Toolbar List Builder will build the List grid for you.
4. Test and Clean Up
After the Toolbar List Builder creates the grid, you will want to test it. Run the form from the Form Designer or the VPME Form Editor and select the toolbar List control. If you want to run the form from your application, build the application first.
You may need to clean up the grid. In particular, if a grid header caption is much longer than the field displayed in the column, you may want to reduce the size of the Grid Caption.
To make changes to a form’s List control, simply open the form in the Form Designer and run the List Builder. The List Builder will display the fields and field properties that you previously selected. Make any changes you want and click OK.