The information in this article applies to:
- Microsoft FoxPro for MS-DOS, versions 2.6, 2.6a
- Microsoft FoxPro for Windows, versions 2.6, 2.6a
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
- Data type (this example covers character, numerical, and date fields).
- Field size for character and numerical fields.
Steps to Create the Example Screen Wizard-Generated Screen
- Start FoxPro, and on the Run menu, click Wizard and then Screen.
- 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.
- 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.
- For the Sort Order of Records', highlight the Cno field and then
Add. Click Next.
- Choose the Standard style. (With the Windows, version, select the
Text button type.) Click Next.
- For the title, enter whatever title you wish. Click the 'Modify
screen with design tool' option and then Finish.
- 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
- On the Screen menu, click Field in MS-DOS, or select the Field tool
in Windows).
- The Field type is Get.
- 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.
- Click the When button. Then choose Expression, and place the cursor
inside the area below. Type "isediting" (without the quotation marks),
and click OK.
- 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.
- 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.
- 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.
- 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.
|