The information in this article applies to:
- Microsoft FoxPro for Windows, versions 2.5x, 2.6, 2.6a
SYMPTOMS
The RETURN TO <filename>.SPR command does not work if it is executed within
an .APP or .EXE file.
WORKAROUND
The RETURN TO <filename>.SPR command will work if it is changed to RETURN
TO <filename>.PRG. However, this method has a drawback: Every time you
modify and regenerate your screen (.SCX), you have to issue the RENAME
command to rename the newly generated screen to a .PRG file.
STATUS
Microsoft has confirmed this to be a problem in the Microsoft products
listed at the beginning of this article. We are researching this problem
and will post new information here in the Microsoft Knowledge Base as it
becomes available.
MORE INFORMATION
Steps to Reproduce Problem
- In the FoxPro Command window, issue the following command:
MODIFY COMMAND MAIN
- Type the following code in MAIN.PRG and save it:
ON ERROR DO errhand WITH ERROR( )
DO test.spr && GET field should cause an error
PROCEDURE errhand
PARAMETER merror
WAIT WINDOW "Error occured: "+STR(merror)
RETURN TO test.spr
- In the FoxPro Command window, issue the following command:
CREATE SCREEN TEST
- Add an input field with M.CHOICE in the Input text box and the
following code in the VALID clause:
IF !EMPTY(m.choice)
WAIT WINDOW "Something in field" && cause error to occur
ENDIF
- Add a push button with OK as the prompt and the Terminate READ On
Selection option selected. Enter any variable in the Variable text
box.
- Save the screen.
- In the FoxPro Command window, issue the following command:
CREATE PROJECT MYTEST
- Click the Add button to add MAIN.PRG as a Program type. FoxPro
automatically mark MAIN.PRG as the main program.
- Click the Add button again to add TEST.SCX as a Screen type.
- Build an application called MYTEST.APP.
- Run MYTEST.APP.
- Type "123" (without the quotation marks) in the input field on the
screen and press ENTER.
Note that a WAIT window containing the text "Error occured: 16" will be
displayed in the top-right corner. Press any key. RETURN TO TEST.SPR in
the error routine will return to the Command window instead of to the
OK button.
- Run MAIN.PRG.
- Repeat step 13.
Note that RETURN TO TEST.SPR returns to the OK button on the screen. The
READ is still active.