The information in this article applies to:
- Microsoft Visual FoxPro for Windows, versions 3.0
- Microsoft FoxPro for Windows, versions 2.5x, 2.6x
- Microsoft FoxPro for MS-DOS, versions 2.0, 2.5x, 2.6x
SUMMARY
You (the developer) can require a person using your application to use
design controls to exit a FoxPro screen by making the screen MODAL. To do
this, use a MODAL clause on the READ command when you design the screen.
However, if you design the screen as non-MODAL, you can still give the
screen a MODAL feel by adding a few lines of code as demonstrated in this
article.
MORE INFORMATION
FoxPro 2.x Steps to Create MODAL-Like Screens by Using Code
- Enter USE <database name> in the Command window to open the table.
- Enter CREATE SCREEN PMODAL in the Command window.
- From the Screen menu pad, choose Quick Screen.
- Choose the default setting in the Quick Screen dialogue box, and
click OK to return to the screen design layout window.
- From the Screen menu pad, choose Layout.
- In the Name entry field, type: smodal.
- Choose Code from the Layout dialogue box.
- Choose the On Window Deactivate button.
- In the Code Snippet dialogue box, type the following lines of code:
*** Begin 'On Window Deactivate Code' ***
IF .t.
ACTIVATE WINDOW smodal
RETURN .f.
ENDIF
*** End 'On Window Deactivate' Code ***
- Click OK to return to the screen layout window.
- Choose Generate from the Program menu pad to generate the screen.
- From Help, choose Calculator to observe the effects of this MODAL-like
window.
- Run the screen generated in steps 1 through 11 above. Note that FoxPro
does not allow the Calculator screen to become active when you attempt to
switch to it.
Visual FoxPro Steps to Create MODAL-Like Screens by Using Code
- Type "ACTIVATE WINDOW CALCULATOR" (without the quotation marks) in the
Command window to start the FoxPro calculator accessory.
- Create a Form containing with a Command button, and add the following
code to the Click event of the Command button:
THISFORM.RELEASE
- Set the Form Name Properties to Form1.
- Add the following code to the Deactivate method of Form1:
Activate Window Form1
Note that you cannot switch to the Calculator window.
|