Dr.
Thomas E. Hicks
Computer Science
Department
Trinity University
Let us assume the Clients.DBF for the following illustrations. The structure/layout is as follows:
NAME .........Character
16
ADDRESS ......Character
16
CITY .........Character
12
STATE ........Character
2
ZIP ..........Character
5
PHONE ........Character
8
BALD .........Logical
1
AGE. .........Numeric
3
NOTES ........Memo
4
Help FoxProCommand <-- enter the on-line FoxPro help system and display the information about the specified command.
Help Use <-- enter the on-line help system and show the information about the command use.
Help List
<--
enter the on-line help system and show the information about the command
list
.
Modify Structure<--
change the layout/structure of the database open in the current work area.
Fields may be deleted with the delete button. Fields may
be added with the insert button. Fields sizes and datatypes may
be changed. Field positions may be switched. All of this can be done quite
easily and quickly. All database records will be automatically adjusted.
(See Below)
Wait "Record Not Found" Window<-- creates a small system type window in the top right corner of the screen. This window contains the message "Record Not Found". All processing is delayed until the user strikes a key or depresses the mouse button.
Wait Window "Hit Any Key To Continue" Timeout 5 <-- creates a small system type window in the top right corner of the screen. This window contains the message "Hit Any Key To Continue". All processing is delayed until the user strikes a key or depresses the mouse button or 5 seconds (which ever occurs first). (See Below)
![]()
All of the FoxPro commands learned thus far may be entered into the Command Window. In order to avoid re-typing collections of commands, all of our FoxPro commands may also be placed into a program file and executed with a single command. The command illustrated in this section shall be used to group and order our commands.
Modify Command FileName <-- create/modify a program file and enter the program editor. The program file will have a .PRG extension. Program files contain one or more FoxPro commands. The menu-driven program editor has the standard cut, paste, copy, etc. text processing options.
Modify Command ListState<-- edits a file, called ListState, and enters the program editor. If the file ListState.PRG does not exit, it iis created and then opened to edit. If the file ListState.PRG does exit, it is opened to edit. (See Below)

The purpose of the ListState program file is to (1) clear the screen, (2) display the Name, Phone, and State fields of all records on the monitor display with a pause, (3) activate a wait window which displays the string "Display of Names is Complete - Hit Any Key To Continue" and (4) clears the screen after the user responds to the Wait Window in step 3. All of these commands could be entered into the Command Window. Let us assume that this is a sequence of commands which the user wishes to do on a regular basis.
1]
Modify
Command ListState.PRG
<-- creates/opens a file,
called ListState, and enters the program editor; the extension is optional.
2] Type the following
Clear
Display All Name, Phone, State
Wait "Display of Names is Complete - Hit Any Key
To Continue" Window
Clear

3] File->Save [pull down the File Menu and select Save to save program file ListState.PRG]
4] ESC [ hit the ESC key to close editor]
Do FileName <-- execute the commands in a program file.
Do ListState <-- execute program file ListState.PRG (not case sensitive)
Do liststate.PRG <-- execute program file ListState.PRG . (all program files must have a .PRG extension; including the extension is optional)
Do LISTSTATE.PRG<--
execute program file ListState.PRG .

Define Window WindowName From X1, Y1 To X2, Y2
Define Window OutputWin From 5,10 To 10,50 <-- by default, it uses the font and size of the parent window. Uses 10 point FoxFont by default. Window OutWin is defined approximately 5 rows and 40 characters to a row; the border is included in the size. When activated the window will look like the following:

Display Memory
<-- displays local variables, FoxPro system variables, window definitions,
menu definitions, and pop-up window definitions. The default number
of user variables that may exit at any one time is 1024; this may be increased
to as many as 65,000. (Only the window variables are displayed below).
Window Definitions
Name
From
To
Size
1 Window Defined
OUTPUTWIN
5.000,10.000
8.188,62.500 368
bytes
Define Window WindowName At X1, Y1 Size X2, Y2
Define Window OutputWin At
5,10 Size 5,40 <-- by default, it uses the font and
size of the parent window. Uses 10 point FoxFont by default. Window OutWin
is defined approximately 5 rows and 40 characters to a row; the border
is included in the size.
Activate Window WindowName <-- open window and make it current user-defined the window must be previously defined.
Activate Window OutputWin <-- open window Output as the current window.As long as OutputWin is the current window, all List, Display, etc. will appear in that window.
Activate Window OutputWin, InputWin, GetStateWin ... <-- open more than one window in one command; the last window in a series becomes the current window. Input is the current window.
Activate Window all <-- open all defined windows in one command; the last window in a series becomes the current window.
Activate Window OutputWin
Noshow <-- direct output to a window without display.
Deactivate Window WindowName <-- close the activated window the previously defined window must be activated.
Deactivate Window OutputWin <-- close the window Output.
Deactivate Window OutputWin, InputWin, DisplayWin... <-- close more than one window in one command
Deactivate Window all
<--
closes all active windows.
Release Window WindowName <-- close the activated window and delete the window definition.
Release Window OutputWin <-- close the activated window and delete the window definition for window Output.
Release Window OutputWin, InputWin, ... <-- close and delete more than one window in one command
Release Window<--
close and delete the current window.
Define Window OutputWin at 1, 2 Size 8, 40 Font 'ROMAN' , 16 <-- Roman 16 Font (See Below)

Define Window OutputWin at 1, 2 Size 8, 40 Font 'ROMAN' , 16 Style 'BI' <-- Bold Italic Font

Style Key

Define Window OutputWin
at 1, 2 Size 4, 60 font 'ROMAN', 12 ;
Style 'OIU' Title 'Output Window'
<-- Title Window
The purpose of the program DisplayNamePhone is to (1) set the default drive and directory to folder Demo on drive C, (2) open the Clients.DBF table, (3) clear the screen, (4) define an output window, called ClientWin - include an appropriate title, (5) bring ClientWin to the desktop as the active window, (6) display the Name, Phone, and State fields of all records in ClientWin with a pause, (6) activate a wait window which displays the string "Hit Any Key To Continue" and (7) takes down the command window.. All of these commands could be entered into the Command Window. Let us assume that this is a sequence of commands which the user wishes to do on a regular basis.
Set Default to c:\Demo
Use Clients
Clear
Define Window ClientWin at
1, 2 size 8, 40 ;
font
'ROMAN', 16 style 'BI' Title 'Client State Listing'
Activate Window ClientWin
Display All Name, Phone, State
Wait "Done - Hit Any Key To
Continue"
Deactivate Window ClientWin
Do DisplayNamePhone<-- execute program file NamePhone.PRG .
Do DisplayNamePhone.PRG<--
execute program file NamePhone.PRG .
Set AutoSave Off<-- information is written to disk every five minutes. This is more hardware and disk efficient, but one could loose five minutes worth of work in the event of a power blackout. (default)
Set AutoSave On
<-- information is written to disk immediately. Each little piece is
written to disk as entered. Since the software does not wait until it has
several changes to update, there is more wear and tear on the hardware
drives when this option is set.
Set Print On <-- all list and display commands direct an additional copy of the ASCII information to the printer.
Set Print Off
<-- a copy of the information will not be directed to the printer. (default)
Set Status Bar On <-- turn on the status bar at the foot of the screen (default)
Set Status Bar Off
<--
turn on the status bar at the foot of the screen.
Set Bell On <-- the bell sounds during editing when invalid data is entered and when the end of a field is reached. (default)
Set Bell On
<--
the edit bell is turned off.
The bell pitch and duration can be set; check the help
system or the manual if desirable.
Set Escape Off
<-- the escape key does not interrupt processing.
Processor is Pentium
Currently Selected Table:
Select area: 1, Table in Use:
C:\CLIENT\CLIENT.DBF Alias: CLIENT
Code page: 1252
Structural CDX file: C:\CLIENT\CLIENT.CDX
Index tag: STATE
Collate: Machine
Key: ALLTRIM(UPPER(STATE))
Index tag: NAME
Collate: Machine
Key: ALLTRIM(UPPER(NAME))
Memo file: C:\CLIENT\CLIENT.FPT
Lock(s):
Exclusive USE
File search path:
Default directory: C:\CLIENT
Print file/device:
Work area
= 1
Margin
= 0
Decimals
= 2
Memowidth
= 50
Typeahead
= 20
Blocksize
= 64
Reprocess
= 0
Refresh
= 0,5 SECONDS
DDE Timeout
= 2000
DDE Safety
= on
Code page: 1252
Collating sequence: Machine
Compiler code page: 1252
Date format: American
Macro Hot Key =
UDF parameters are passed by:
VALUE
Textmerge Options
Delimiters: Left = << Right = >>
Show
Alternate
- off Fullpath
- on
ANSI
- off Heading
- on
Asserts
- off Help
- on
Bell
- off Intensity
- on
Blink
- on
Lock
- off
Brstatus
- off Logerrors
- on
Carry
- off Mouse
- on
Century
- off Multilocks
- off
Clear
- on Near
- on
Color
- on
Null
- off
Compatible
- off Optimize
- on
Confirm
- off Print
- off
Console
- on
Readborder - off
Cursor
- on Safety
- on
Deleted
- on
Space
- on
Device
- scrn Status
Bar - on
Echo
- off Sysmenus
- on
Escape
- on Talk
- on
Exact
- off Textmerge
- off
Exclusive
- on
Title
- off
Fields
- off Unique
- off
Fixed
- off
List Status <-- display FoxPro environment information. Databases open, indexes, relations, the procedure file in use, the default drive, the current work area, etc. All of the set option variables, such as bell, escape, print, near, status bar, autosave, etc. will be displayed. As is the case with all display options, the output will not pause when the screen is full.
List Status To File Status<-- displays the FoxPro environment information on the screen and creates a text copy in file Status.TXT in the current directory. (no pause)
List Status To Print<--
print the FoxPro environment information. (no pause)