How to Add Table Fields to Screen Wizard-Generated Screens

ID: Q135624

The information in this article applies to:

SUMMARY

This article shows by example how to add a table field to a Screen Wizard- generated screen while addressing the conventions that will help to ensure that the change does not conflict with the screen's original functionality.

Sometimes it is desirable to add table fields to a Screen Wizard- generated screen program. This is particularly true if the Screen Wizard did not incorporate all the table fields when it created the original screen or if new fields were added to the table after the Screen Wizard was initially run.

The generated code that drives a Screen Wizard-generated screen is very complex. Making even the slightest change to it can easily induce problems with the screen's original functionality.

MORE INFORMATION

Things to Know About the Field to Be Added

Steps to Create the Example Screen Wizard-Generated Screen

1. Start FoxPro, and on the Run menu, click Wizard and then Screen.

2. In the Screen Wizard, click the Open button. In the Tutorial

   subdirectory of the FoxPro root directory, select the Customer.dbf
   table, and then click Next.

3. For the Selected Fields, click the Add All option. Once all of the
   fields have been added, remove one for this example. At the bottom of
   the Selected Fields list, select Long and then click the Remove button.
   Click Next.

4. For the Sort Order of Records', highlight the Cno field and then
   Add. Click Next.

5. Choose the Standard style. (With the Windows, version, select the
   Text button type.) Click Next.

6. For the title, enter whatever title you wish. Click the 'Modify
   screen with design tool' option and then Finish.

7. If you wish to save this as something other than Customer.scx
   enter whatever you like. Then click the Finish button. Upon
   completion, you will be taken directly to the Screen Editor.

Steps to Add the Field

1. On the Screen menu, click Field in MS-DOS, or select the Field tool

   in Windows).

2. The Field type is Get.

3. In the area to the right of the Get button (MS-DOS) or to the right

   of the Input button (Windows), type m.long.

   NOTE: Wizard Screens create memory variables for all of the fields
   of the table. All of these variables are named for the field they
   represent and have an m. prefix.

4. Click the When button. Then choose Expression, and place the cursor
   inside the area below. Type "isediting" (without the quotation marks),
   and click OK.

5. Select Format and choose Character. In the area below format, type
   999.9999. Then choose OK to close the Format window and OK again to
   close the Field window.

   NOTE: The Long (longitude) Field is actually of a Numerical data
   type. The Character Type Format for this is a Wizard Standard. The
   999.9999 is derived from the Data Type as Numerical, 8 places total
   (including the decimal) with 4 places to the right of the decimal.
   If this had been a Character Type Field, the Format would have
   been composed of a number of upper case X that corresponds to the
   field width. For example, a five Character wide field would have a
   format of XXXXX. For a Data Type of Date, the Character Type Format
   still applies, but nothing should be entered into the format box.

6. Place the new field wherever you like on the Screen. In Windows, you
   may wish to highlight the field, and select the Object menu to change
   the Fill Color and Font to match the other fields on the screen.

7. To make a title in MS-DOS, type it on the screen. To do this in Windows,
   highlight, copy (CTRL-C), and paste (CTRL-V) one of the other titles;
   then double-click the copy and change the Output.

8. On the Program menu, click Generate and then Yes to save changes. Then
   click Generate again in the Screens/Screen Set Window. This
   final step produces a Screen Program that is derived from a
   Screen Wizard .scx file.

Additional reference words: 2.60 2.60a FoxWin FoxDos KBCategory: kbtool KBSubcategory: FxtoolWizscreen

Last Reviewed: August 25, 1995