How to Add Code to WHEN Snippets Created from ScreenWizard

Last reviewed: August 28, 1995
Article ID: Q121277
The information in this article applies to:
  • Microsoft FoxPro for Windows, version 2.6

SUMMARY

When a screen is created using the ScreenWizard, the ScreenWizard puts commands in the WHEN snippet to control field activity. This control is in the form of a logical variable called ISEDITING, and is used as an expression. If you need to put code in a field-level WHEN, change the expression to a procedure. By changing the snippet to a procedure, you change the ISEDITING variable's ability to activate or deactivate the data entry field.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Enter the following command in the Command Window:

    USE Customer

  2. Select the RUN/WIZARD/SCREEN menu options. Then select 'Add All' fields; no sorting; 'Modify screen with design tool.'

  3. Double-click the field called cno, and select the WHEN push button to edit the snippet. Click the radio-button Procedure. Change the snippet to read as follows:

    WAIT WINDOW "The Customer.cno when snippet is running" isediting

  4. Click OK twice to save the changes to the field. Select the PROGRAM/GENERATE menu options. Save the changes, and Generate the screen.

  5. Run the screen. The message: "The Customer.cno when snippet is running" appears in the Wait Window, followed by the error, "Unrecognized command verb".

Resolution to Behavior

Type the following into the Command window:

   MODIFY SCREEN CUSTOMER

Then start at step 3 above and change the customer.cno WHEN snippet to read as follows:

   WAIT WINDOW "The Customer.cno when snippet is running"
   RETURN iseditting


Additional reference words: FoxWin 2.60
KBCategory: kbusage kbtshoot
KBSubcategory: FxtoolWizscreen


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