[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
+---------------------------------+
| DO |
+---------------------------------+
DO <file>
[WITH <parm list>]
[IN <file>]
-----------------------------------
Executes program or procedure file.
-----------------------------------
The DO command executes a program. A program file can itself contain
additional DO commands. This nesting of DOs is limited to a depth of
32.
When you use the DO command to run the program, the commands contained
in the program file are executed. Programs will continue to execute
until one of the following occurs:
. A RETURN command is executed
. A CANCEL command is executed
. A QUIT command is executed
. The end of the file is reached
. Another DO command is issued
When file execution is complete, control is returned to the calling
program, the Command window or to DOS.
Doing a program in a directory and drive other than the current default
directory and drive from the Do... option of the Program menu popup
changes the default directory and drive. The directory and drive the
program is done from becomes the new default directory and drive.
To specifically DO a menu program, screen program or a query, you must
include its extension (.MPR, .SPR and .QPR respectively).
Clauses
-------
WITH <parm list>
Passes parameters to a program. Parameters can include UDFs. The
<parm list> contains expressions, memory variables, literals, database
fields or UDFs. By default parameters are passed to programs or
procedures by reference. A parameter can be passed by value to a
program or procedure by placing the parameter in parentheses. See the
SET UDFPARMS command for a discussion of passing parameters by value or
reference to a UDF, and the PARAMETERS command for additional
information on parameter passing.
IN <file>
Executes procedure in specific program <file>. If you don't include an
extension, FoxPro looks for and executes programs in the following
order:
.EXE - Executable version
.APP - An application
.FXP - Compiled version
.PRG - The program
+---------------------------------+
| Program Example |
+---------------------------------+
In this example, CUSTOMER database is opened and first record is
displayed. Options allow you to move forward, backward, top, bottom or
quit. Once you make a choice, FoxPro moves record pointer by using DO
command to run appropriate PROCEDURE, or if you choose Quit option,
program is exited.
CLOSE ALL
SET TALK OFF
DEFINE WINDOW customer FROM 3,3 TO 13,57 ;
FLOAT SHADOW DOUBLE
DEFINE WINDOW panel2 FROM 2, 61 TO 14,74 ;
FLOAT SHADOW DOUBLE COLOR SCHEME 5
USE customer
ACTIVATE WINDOW customer NOSHOW
@ 3,3 SAY 'Company'
@ 3,14 GET customer.company SIZE 1,35
@ 5,3 SAY 'Contact'
@ 5,14 GET customer.contact SIZE 1,35
@ 7,3 SAY 'City/State'
@ 7,14 GET customer.city SIZE 1,21
@ 7,36 GET customer.state
@ 7,39 GET customer.zip
@ 0,3 SAY 'Customer #'
@ 0,15 SAY cust_id SIZE 1,6
@ 0,36 SAY 'Record #'
@ 0,46 SAY RECNO() SIZE 1,3
ACTIVATE WINDOW panel2
@ 1,2 GET act PICTURE;
'@*VN Top;Prior;Next;Bottom;\?Quit' ;
SIZE 1,8,1 DEFAULT 0 VALID actvalid()
READ CYCLE SHOW readshow() COLOR ,r/bg
RELEASE WINDOWS customer,panel2
FUNCTION actvalid
DO CASE
CASE act = 1
GO TOP
CASE ACT = 2
DO go_prev
CASE ACT = 3
DO go_next
CASE act = 4
GO BOTTOM
CASE act = 5
CLEAR READ
ENDCASE
SHOW GETS
RETURN 0
FUNCTION readshow
STORE WOUTPUT() TO currwind
IF SYS(2016) = 'customer' OR SYS(2016) = '*'
ACTIVATE WINDOW customer SAME
@ 0,15 SAY cust_id SIZE 1,6
@ 0,46 SAY RECNO() SIZE 1,3
ENDIF
IF NOT EMPTY(currwind)
ACTIVATE WINDOW (currwind) SAME
ENDIF
RETURN .T.
PROCEDURE go_prev
SKIP -1
IF BOF()
GO TOP
ENDIF
RETURN
PROCEDURE go_next
SKIP 1
IF EOF()
GO BOTTOM
ENDIF
RETURN
-----------------------------------
See Also: CLEAR, PARAMETERS, PARAMETERS(), PRIVATE, PROCEDURE, PUBLIC,
SET DEVELOPMENT, SET PATH, SET PROCEDURE
-----------------------------------
See Also:
CLEAR
PARAMETERS
PARAMETERS()
PRIVATE
PROCEDURE
PUBLIC
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson