How to Create a Wait-Processing Program/Window

Last reviewed: October 18, 1996
Article ID: Q103008
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, versions 3.0, 5.0
  • Microsoft FoxPro for Windows, version 2.5

SUMMARY

In some cases, you may want to use a screen other than a thermometer bar to notify the user to wait while some commands are being executed.

The procedure below, which is divided into three parts, creates a window that specifies what commands are being executed and animates a wedge moving inside a circle. After all the commands are executed, the window is cleared.

MORE INFORMATION

Creating the Bitmaps

  1. In the Accessories group in Program Manager, open Paintbrush.

  2. From the Options menu, choose Image Attributes.

  3. Set Width and Height to 2 inches, and choose OK.

  4. Draw a circle that takes up the majority of this 2-inch square.

  5. Draw two lines in a cross hair pattern so that the circle is split into four equal parts.

  6. Save the image as SPIN.BMP.

  7. Color the upper-right fourth of the circle and save it as SPIN1.BMP.

  8. Color the lower-right fourth of the circle and save it as SPIN2.BMP.

  9. Repeat step 8 for the next two wedges in clockwise order and save the next two pieces as SPIN3.BMP and SPIN4.BMP.

  10. Minimize Paintbrush and start FoxPro for Windows.

Creating the Database for the Bitmaps

  1. Create a database called SPIN.DBF that has one field named SPINPICT of type general.

  2. Copy and paste bitmaps SPIN1.BMP, SPIN2.BMP, SPIN3.BMP, and SPIN4.BMP into the corresponding general fields in the database (order is important--SPIN1.BMP should be pasted into the first record, SPIN2.BMP should be pasted into the second record, and so on).

Creating the Screen

  1. Create a new screen.

  2. Use the Picture tool (see page U11-10 of the "User's Guide") to draw a graphic object that is 2 inches by 2 inches (use the ruler).

  3. When the Screen Picture dialog box appears, choose Field.

  4. In the Choose Field/Variable dialog box, select spin.spinpict, and choose OK.

  5. Select the Scale Picture--Fill The Frame and Refresh Output Field options. Choose OK.

  6. Select the Field tool (see page U11-10) and draw a field on the screen.

  7. When the Field dialog box appears, select Output Field (Say) under Field and type "waittext" (without the quotation marks) in the box that is beside the Output button.

  8. Under Options, select Refresh Output Field, and choose OK.

  9. In the Screen Setup code for the screen, type:

    PUBLIC waittext waittext=" "

  10. In the Cleanup and Procedures code for the screen, type:

              PROCEDURE spinit
              FOR i=1 TO 3
                 GOTO 1
                 SHOW GETS
                 GOTO 2
                 SHOW GETS
                 GOTO 3
                 SHOW GETS
                 GOTO 4
                 SHOW GETS
              ENDFOR
              RETURN
    
    

  11. In the On Screen Entry (When)... code for the screen, type:

               waittext="Executing Command 1" && Text that is displayed
                                              && telling user what
                                              && routine/command is being
                                              && executed.
    
               DO spinit                      && Animate the wedge moving.
    
               ** The WAIT WINDOW command below is for the purpose of
               ** demonstrating where to put a command to be executed and
               ** should be replaced with actual command.
               WAIT WINDOW 'Command 1'
    
               waittext="Executing Command 2" && Text that is displayed
                                              && telling user what
                                              && routine/command is being
                                              && executed.
    
               DO spinit                      && Animate the wedge moving.
    
               ** The WAIT WINDOW command below is for the purpose of
               ** demonstrating where to put a command to be executed and
               ** should be replaced with actual command.
               WAIT WINDOW 'Command 2'
               CLEAR READ                     && Clear Window/Read
    
    

  12. Select the Center and Modal Screens options before generating the screen so that the window will come up centered and the user will not be able to access other menu options.


Additional reference words: 5.00 VFoxWin 3.00 FoxWin 2.50
KBCategory: kbprg kbui kbcode
KBSubcategory: FxtoolGeneral


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: October 18, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.