How to Create a Modal Browse Window

Last reviewed: April 30, 1996
Article ID: Q121027
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, version 3.0
  • Microsoft FoxPro for Windows, versions 2.5x, 2.6, 2.6a
  • Microsoft FoxPro for MS-DOS, versions 2.0, 2.5x, 2.6, 2.6a
  • Microsoft FoxPro for Macintosh, versions 2.5x, 2.6a
  • Microsoft FoxPro for UNIX, version 2.6

SUMMARY

The window in which a BROWSE is presented is, by default, not a modal window. This means that users can activate other windows while a Browse window is on the screen. In some cases, you may want the Browse window to be modal so that users cannot activate other windows while the Browse window is active. This article explains how to create a modal Browse window.

MORE INFORMATION

The following sample code produces two Browse windows. The second Browse window will be modal so that users cannot activate any other window.

   * The BROWSE will be terminated when F5 is pressed.
   * Disable the ESC key.

   ON KEY LABEL f5 DO myquit
   ON KEY LABEL esc *

   * Create a sample table for the first BROWSE.

   SELECT 1
   CREATE TABLE one (myfield C(1))
   INSERT INTO one (myfield) VALUES ("A")

   * Display the first Browse window.

   DEFINE WINDOW winone FROM 01,01 TO 10,50
   BROWSE NOWAIT WINDOW winone

   * Create a sample table for the second BROWSE.

   SELECT 2
   CREATE TABLE two (myfield C(1))
   INSERT INTO two (myfield) VALUES ("B")

   * Display the second Browse window.

   DEFINE WINDOW wintwo FROM 11,01 TO 20,50
   BROWSE NOWAIT WINDOW wintwo

   mquit = .F.

   READ MODAL WITH two VALID mquit=.T.

   * This point will be reached when the READ was
   * terminated by pressing the F5 key. Clear the
   * ON KEY LABEL assignments.

   ON KEY LABEL f5
   ON KEY LABEL esc

   RETURN

   PROCEDURE myquit
      mquit = .T.
      CLEAR READ

      * Release the window definitions.

      RELEASE WINDOW winone
      RELEASE WINDOW wintwo

      * Release the Browse windows.

      RELEASE WINDOW one
      RELEASE WINDOW two

      RETURN


Additional reference words: VFoxWin 3.00 FoxUnix FoxMac FoxDos FoxWin 2.00
2.50 2.50a
2.50b
2.50c 2.60 2.60a
KBCategory: kbprg
KBSubcategory: FxprgBrowse


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 30, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.