6 |
The LA Fox Developer Newsletter
|
March 1995
|
Hot Tip....
How to Create an Interruptible Report in Microsoft FoxPro
Document Number: Q89146 PubI Date: 16-SEP-1994
Product Name: Microsoft FoxPro
Product Version: 2.00 2.50 2.50a 2.50b
Operating System: MS-DOS
To allow the user to interrupt generating a report, place a user-defined function (UDF) as a field object in the Detail band of the report.
For example, if you want to create a UDF to interrupt a report, place a field named STOPO on the Detail line of the report. Then create the following program named STOP.PRG in the same directory as your report:
STOP~PRG
SET TALK OFF
IF CHRSAWO
WAIT CLEAR
IF LASTKEYOI3
SET TYPEAHEAD TO 0
DEFINE WINDOW stopit FROM 10,10 TO 14,60 DOUBLE
ACTIVATE WINDOW stopit
x0
PICTURE HO*H Yes ; No”
READ
IF
x1
GO BOTTOM
ENDIF
ENDIF
DEACTIVATE WINDOW stopit
ENDIF
SETTALKON
SET
TYPEAHEAD
TO 20
NOTE: SET
TYPEAHEAD
prevents FoxPro from referring to the ENTER key already in the keyboard buffer (the print action calls the Print dialog box with the PROMPT command).
The first time you run the code, you must press the ESC key to
cancel
printing. The second time, and every time thereafter, if you press ENTER when the report is in process, a dialog box prompts you for the appropriate action.
[COPYRIGHT Microsoft Corporation, 1994.)
|
Software Metrics
(Con? from page
5)
The following code is the code used to capture and log in the error into errhand.dbf
ERRHAND.PRG
=lusage(sys(16)) && I’ll get back to this later.
private cdbf, erraction, muser, i, oldsel, scrcode, topwind private errnum, errmsg, line_num, src, oldtalk, oldecho,;
curobj, olderr
olderr
=
ON(”ERROR”) ON ERROR ginflag
=
iif(getenv(”NFLAG”)=”YES”,.t,.f.) crntwind
=
wontopO
if type(’gcappname’)
=
“U”
gcappname
=““
endiftype()
if
type(’gnstart’)
=
“U”
gnstart
=0
endiftypeO
oldsel
=
selectO cdbf= dbf() erraction
““
oldtalk
=
setC’TALK”) oldecho
=
set(”ECHO”)
set talk off
set echo off
MOSER
=
GETENVrUSER”)
(Con't, page 7)
|
Page
6
|
6 |