Help and Support
 

powered byLive Search

How to display a progress bar in the status bar in Visual FoxPro 9.0 and earlier versions

Article ID:259296
Last Review:February 12, 2007
Revision:2.4
This article was previously published under Q259296
On This Page

SUMMARY

This article illustrates how to create a progress bar to display in a status bar when a SELECT-SQL query is performed in Microsoft Visual FoxPro 9.0 and earlier versions.

Back to the top

MORE INFORMATION

Sample Code

1.Create a program (.prg) file in Visual FoxPro.
2.Put the following code into the .prg file:
SET STATUS BAR ON
PUBLIC obar
**Open table
cTable = GETFILE("dbf")
IF EMPTY(cTable)
   RETURN .T.
ENDIF   

**Create the Progress bar object
obar = CREATEOBJECT("POnStatus")
obar.pIndicatorStyle = "||"
SELECT * FROM (cTable) WHERE obar.DrawStatus(RECNO(), RECCOUNT())
SET MESSAGE TO
CLOSE ALL
RELEASE ALL

** Class definition for the Progress bar object
DEFINE CLASS POnStatus AS Custom
    pIndicatorStyle = ""
     
    PROCEDURE DrawStatus
    LPARAMETER nRecno, nReccount
    LOCAL nPtr, cIndicator
    
        nPtr = INT(nRecno*100/nReccount)
        cIndicator = REPLICATE(THIS.pIndicatorStyle, nPtr) + ;
           SPACE(2) + STR(nPtr)+"%"
        SET MESSAGE TO LEFT(cIndicator, LEN(cIndicator))
        RETURN .T.
    ENDPROC

ENDDEFINE     

					
3.Save and run the .prg file.
4.When prompted with the Open dialog box, select a table such as the Customer table in the Samples directory. While the query runs, you can see the progress bar updating in the status bar.

Back to the top

REFERENCES

For additional information on creating a thermometer bar, click the article number below to view the article in the Microsoft Knowledge Base:
139388 (http://support.microsoft.com/kb/139388/EN-US/) How To Create a Thermometer Bar in Visual FoxPro

Back to the top


APPLIES TO
Microsoft Visual FoxPro 5.0 Standard Edition
Microsoft Visual FoxPro 5.0a
Microsoft Visual FoxPro 6.0 Professional Edition
Microsoft Visual FoxPro 7.0 Professional Edition
Microsoft Visual FoxPro 8.0 Professional Edition
Microsoft Visual FoxPro 9.0 Professional Edition

Back to the top

Keywords: 
kbcodesnippet kbdatabase kbhowto kbsqlprog KB259296

Back to the top

Article Translations

 

Related Support Centers

Other Support Options

  • Need More Help?
    Contact a Support professional by E-mail, Online or Phone.
  • Customer Service
    For non-technical assistance with product purchases, subscriptions, online services, events, training courses, corporate sales, piracy issues, and more.
  • Newsgroups
    Pose a question to other users. Discussion groups and Forums about specific Microsoft products, technologies, and services.