ProMatrix Basic Form Builder

The VPM Enterprise Basic Form Builder is a builder that automates the creation of a form based on the Form_Toolbar or the Form_Singlerecord class. Use this builder when you need to create a data maintenance form that maintains data from one table, view or CursorAdapter.

Ø To build a basic form

Opening the Form Editor: The steps below assume that you already have opened the Form Editor for the new form you are creating. You can open a Form Editor for a new form by adding a menu option or through the Called Objects list of another Object Editor. If you need help with opening the Form Editor for a new form, see How to Begin Creating a New Application Object.

1. New Form Dialog

Click the Edit button on the Form Editor. VPM Enterprise displays the New Form dialog.

With the Blank – Template Class option button selected, click OK. VPME brings up the Visual FoxPro Form Designer with your default form class template displayed.

2. Change the Form Class

If the form displayed when the Form Designer first appears is not based on the class you want (which must be the Form_Toolbar or Form_Singlerecord class), change the form class to either the Form_Toolbar class or the Form_Singlerecord class.

1.   Click the View Classes icon on the Form Controls Toolbar. (It's the icon with the books.) On the menu popup select the form class library you are using (either Vpmforms, Devforms or Proforms). The Controls Toolbar will change to show a list of form class icons.

2.   Move the mouse pointer over the form class icons and use the tool tips to locate the form class you want. Click the icon of the form class you want.

3.   Move the mouse pointer over the form displayed in the Form Designer window. The pointer changes to a form icon. Click the left mouse button. The Form Designer adds a form based on the form class you selected and creates a form set.

4.   Important – Remove Unwanted Form: Remove the form you don't want. Move the form you want until the form you don't want is visible. Click on the form you don't want. Click the Remove Form option on the Form menu.

5.   Very Important – Remove Form Set: Remove the form set. Click the Remove Form Set option on the Form menu.

Tip – Remove Form Set: The Number 1 mistake people seem to make when they change a form class is forgetting step 5 — removing the form set. Don’t let that happen to you.

3. Set Up the Data Environment and Form Properties

1.   Open Data Environment: Click the form with your right mouse button. Click the Data Environment option on the popup menu. The Form Designer displays the Data Environment window and the Add Table or View dialog.

2.   Tables and Views: Add all the tables and views you will use on the form to the Data Environment. Set any relations needed.

3.   CursorAdapters: To add a CursorAdapter to the Data Environment:

·       If it’s not already open, open the Data Environment of the form.

·       Right-click on the Data Environment window.

·       Select the Builder option on the right-click menu. Note: If you select the Add CursorAdapter option on the right-click menu, an empty CursorAdapter will be added to the Data Environment that is based on the default VFP CursorAdapter class, which is not what you want.

·       In the DataEnvironment Builder form activate the Cursors page.

·       Click the Add button.

·       In the Open dialog find the class library that contains the CursorAdapter class that you want to add to the Data Environment. Then, select the desired CursorAdapter class and click the OK button.

·       Important: In the CursorAdapter Builder form that comes up, click the Cancel button. See Avoiding a VFP CursorAdapter Builder Error.

·       The selected CursorAdapter will then appear in the list of CursorAdapters in the DataEnvironment Builder form. Click the OK button and the CursorAdapter will be added to the DE.

4.   BeforeOpenTables Event: For every form you create that includes a view or CursorAdapter in the Data Environment, add the following two lines of code to the BeforeOpen Tables Event of the Data Environment (see Special Steps for Views and CursorAdapters):

   SET TALK OFF
SET DELETED ON

   Matching Remote Views: If you will be using matching remote views with the form, add the following line of code to the BeforeOpenTables event:

   _SCREEN.oApp.LocalToRemote (This)

5.   Order Property for Tables: Set the Order property of the cursor for the form's main, or active, table if you want to specify the order of the table when the form first appears.  

·       cInitialTag Property for Views and CursorAdapters: While you can set the initial order for an InitialSelectedAlias (ISA) table through the Order property of the cursor. You cannot do that if the ISA is a view or CursorAdapter. Instead, use the cInitialTag property of the form. In the cInitialTag property of the form enter the Tag Name in the Data Builder for the tag definition that you want to use to set the initial order for a view or CursorAdapter ISA. If you like, you can also use this property to set the order for ISA tables instead of the Order property of the cursor.

6.   Very Important - InitialSelectedAlias: Set the Data Environment InitialSelectedAlias property to the main table’s, view’s or CursorAdapter’s alias.

7.   NoDataOnLoad Property - Views: Set every filtered view's Data Environment cursor NoDataOnLoad property to .T.

8.   NoData Property – CursorAdapters: Set the NoData property of every filtered CursorAdapter in the Data Environment to .T.

9.   Private Data Session: If you do not want the form to use a private data session, set the form’s DataSession property to “1”.

10. Find Form: You can choose to display the VPME Standard or SQL Find Form at form startup by setting the form's lStartWithFind property to .T.

4. Run the ProMatrix Basic Form Builder

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

    

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

    

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

·       Form Name: Enter a unique name not used on any other form in the application.

·       Form Caption: Enter the caption that you want to display in the form's title bar.

·       Select Fields: The ProMatrix Basic Form Builder shows the fields from the tables, views and CursorAdapters in the Data Environment. Move the fields you want on the form from the Unselected Fields list to the Selected Fields list.

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

·       Label: The field Description (Long) property entry from the Data Builder. The Form Builder will put this label on the form.

Tip: After the form is built, you can change a label on the form to something other than the field Description (Long) text in the Data Builder. To do this, select the label, change it's Caption property to the text you want, and then change the label’s lOverrideCaption property to .T..

·       Control Type: The default VPM Enterprise control class that will be used to put the field on the form. You can change the control class via the Control Type combo box. For example, by default VPM Enterprise puts a numeric field on a form using the TextBox class. You can change the class to the Spinner class via 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 read-only, check this box.

5.   Build Form: When you have selected the fields you want on the form and have set up the Selected Field Properties, click the Build Form button. The ProMatrix Basic Form Builder will build the form for you. The Builder will place on the form the fields you select along with each field’s label from the Data Builder. The Builder will also select the appropriate VPM Enterprise data control class for each field and autosize text boxes.

5. 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.

6. Run the Form to Test It

You can run the form to test it from the Form Designer or by clicking the Run button on the Form Editor, providing that the form uses standard VPME classes and objects. If you modify the VPME classes or objects or use your own, you may need to test the form by building and running the application.

To run the form from the Form Designer, select the Run option on the Form menu or right-click the form and select Run from the popup menu.

7. Build the Application

Before you can view the form in your application, you must rebuild the application. Click the Build Application button on the Object Builder to rebuild.

More:

ProMatrix PageFrame Builder