Microsoft KB Archive/120790

= How to Create a Modal Screen Effect Programmatically =

Article ID: 120790

Article Last Modified on 10/15/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft FoxPro 2.0

-



This article was previously published under Q120790



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.



FoxPro 2.x Steps to Create MODAL-Like Screens by Using Code
 Enter USE 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 dialog 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 dialog box.</li> Choose the On Window Deactivate button.</li>  In the Code Snippet dialog 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 *** </li> Click OK to return to the screen layout window.</li> Choose Generate from the Program menu pad to generate the screen.</li> From Help, choose Calculator to observe the effects of this MODAL-like window.</li> 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.</li></ol>

Visual FoxPro Steps to Create MODAL-Like Screens by Using Code
<ol> Type "ACTIVATE WINDOW CALCULATOR" (without the quotation marks) in the Command window to start the FoxPro calculator accessory.</li>  Create a Form containing with a Command button, and add the following code to the Click event of the Command button: THISFORM.RELEASE </li> Set the Form Name Properties to Form1.</li>  Add the following code to the Deactivate method of Form1: Activate Window Form1 </li></ol>

Note that you cannot switch to the Calculator window.

Additional query words: FoxDos FoxWin VFoxWin 2.50 2.50a 2.50b 2.60 2.60a make on fly

Keywords: kbcode KB120790

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.