How to Determine the Active & Previously Active Forms

Last reviewed: December 14, 1995
Article ID: Q141143
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, versions 3.0 and 3.0b

SUMMARY

The command _SCREEN.ACTIVEFORM.NAME tells you the name of the active form. There is another way to determine the currently active form and to determine which form was active before the current form.

MORE INFORMATION

  1. Create three forms (Form1, Form2, and Form3).

  2. Open the debug window and type the following:

    _SCREEN.FORMS(1).NAME _SCREEN.FORMS(2).NAME _SCREEN.FORMS(3).NAME _SCREEN.ACTIVEFORM.NAME _SCREEN.FORMCOUNT

  3. Inside the Command window, type the following:

    DO FORM FORM1 DO FORM FORM2 DO FORM FORM3

    Note the following from the debug window:

       _SCREEN.FORMS(1).NAME         FORM1
       _SCREEN.FORMS(2).NAME         FORM2
       _SCREEN.FORMS(3).NAME         FORM3
       _SCREEN.ACTIVEFORM.NAME       FORM3
       _SCREEN.FORMCOUNT             3
    
       Note that _SCREEN.FORMS(3)= _SCREEN.ACTIVEFORM
    
    

  4. Select Form1, and note the following changes from the debug window:

       _SCREEN.FORMS(1).NAME         FORM2
       _SCREEN.FORMS(2).NAME         FORM3
       _SCREEN.FORMS(3).NAME         FORM1
       _SCREEN.ACTIVEFORM.NAME       FORM1
       _SCREEN.FORMCOUNT             3
    
    

Notes

_SCREEN.FORMS(_SCREEN.FORMCOUNT) always references the active form object.

_SCREEN.FORMS(_SCREEN.FORMCOUNT).NAME references the name of the active form.

_SCREEN.FORMS(_SCREEN.FORMCOUNT).CAPTION references the caption of the active form.

_SCREEN.FORMS(_SCREEN.FORMCOUNT -1) always references the previously active form object.

_SCREEN.FORMS(_SCREEN.FORMCOUNT-1).NAME references the name of the previously active form.

_SCREEN.FORMS(_SCREEN.FORMCOUNT -1).CAPTION references the caption of the previously active form.


Additional reference words: 3.00 3.00b VFoxWin
KBCategory: kbtool kbhowto
KBSubcategory: FxtoolFormdes


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: December 14, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.