Microsoft KB Archive/105505

From BetaArchive Wiki

FIX: Error Caused by Object-Level Reference to #WNAME Window

ID: Q105505


The information in this article applies to:

  • Microsoft FoxPro for Windows, version 2.5


An object-level clause that refers to a window name defined by the #WNAME generator directive causes the Screen Builder to generate two lines of code for that clause.

The first line uses the random window name created by the Screen Builder during program generation; the second uses the window name defined by #WNAME.


Microsoft has confirmed this to be a problem in FoxPro 2.5 for Windows. This problem was corrected in FoxPro 2.5a for Windows.


Steps to Reproduce Problem

 1. Use the Screen Builder to create a new screen.

 2. From the Screen menu, choose Layout. Under Options, choose the
    Code button. Then choose the Screen Setup Code button. Choose OK
    twice to go to the Setup Snippet window.

 3. In the Setup Snippet window, type the following:

       #WNAME somename

    Close the Setup Snippet window to return to the Screen Design

 4. Create an input (GET) field.

 5. In the Field dialog box, choose Input. In the Choose A Field Or
    Variable text box, type "x" (without the quotation marks). Choose
    OK to return to the Field dialog box.

 6. In the Field dialog box, under Clauses, choose the Valid button.
    Verify that Procedure is selected in the Code Snippet dialog box.
    Type the following code in the text box:

       ACTIVATE WINDOW somename

    Choose OK twice to return to the Screen Design window.

 7. Save the screen as TEST.SCX (assuming you do not already have a
    file with the same name). When asked to "Save environment
    information?", choose No.

 8. Generate TEST.SPR, and then close the Screen Design window.

 9. Run TEST.SPR.

10. Press the TAB key once to activate the VALID clause.

    The following program error is generated:

       WINDOW 'SOMENAME' has not been defined.

11. Choose Cancel from the Program Error message box. The TEST.SPR file is automatically opened. Note that the ACTIVATE WINDOW command appears twice. The first command uses the random window name generated by the Screen Builder; the second uses the window name "somename."

For example, the code will look similar to the following (the generator-named window, "_qjm0tqik8," will be different, however):

   ACTIVATE WINDOW _qjm0tqik8

Additional reference words: FoxWin 2.50 buglist2.50 fixlist2.50a errmsg err msg WHEN KBCategory: KBSubcategory: FxtoolSbuilder

Keywords          : kberrmsg FxtoolSbuilder 
Version           : 2.50
Platform          : WINDOWS
Solution Type     : kbfix

Last Reviewed: May 22, 1998
© 1999 Microsoft Corporation. All rights reserved. Terms of Use.