Microsoft KB Archive/259296

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

Article ID: 259296

Article Last Modified on 2/12/2007

-

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

-



This article was previously published under Q259296



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.



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

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

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

ENDDEFINE

 Save and run the .prg file. 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.

