The information in this article applies to:
- Microsoft FoxPro for Windows, versions 2.5, 2.5a, and 2.5b
- Microsoft FoxPro for MS-DOS, versions 2.5, 2.5a, and 2.5b
- Microsoft FoxPro for Macintosh, version 2.5b
SYMPTOMS
A screen created by the Screen Builder does not run.
CAUSE
The screen's Setup snippet contains a function or procedure.
RESOLUTION
Move the function or procedure to the Cleanup snippet. This is where
functions and procedures should be placed.
STATUS
This behavior is by design.
MORE INFORMATION
The code below a procedure or function is not executed unless that
procedure or function is called. When the procedure or function is located
in the Setup snippet, all the remaining code below it (for the screen) is
treated as a part of the procedure or function.
Steps to Reproduce Problem in FoxPro for Windows
- Assuming FoxPro is installed in a directory named FOXPROW on drive
C, type the following in the Command window:
USE C:\FOXPROW\TUTORIAL\CUSTOMER
CREATE SCREEN test
- From the Screen menu, choose Quick Screen.
- In the Quick Screen dialog box, choose OK.
- From the Screen menu, choose Layout.
- Under Options, choose Code.
- Under Screen Code And Clauses, choose Screen Setup Code, then
choose OK twice.
- In the Setup snippet window, type the following:
WAIT WINDOW "Before function"
function Test
x = ""
RETURN x
WAIT WINDOW "After function"
NOTE: This behavior also occurs when a procedure is placed in the
Setup snippet instead of a function.
- Close the Setup snippet window, saving the changes.
- From the Program menu, choose Generate.
- When prompted to save changes to the screen, choose Yes.
- When prompted to save environment information, choose Yes.
- In the Generate Screen dialog box, choose Generate.
- Close the Screen Design window.
- In the Command window, type "DO test.spr" (without the quotation
marks).
Note that the first WAIT WINDOW appears. After you press a key to
continue, however, the Command window reappears.
|