Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get a progress bar with an SQL statement at runtime

SQL Syntax

How to get a progress bar with an SQL statement at runtime

by  Mike Gagnon  Posted    (Edited  )
Code:
DEFINE WINDOW dummy FROM 0,0 TO 1,1
SET TALK WINDOW dummy
SET TALK ON

*
* put your query here
*
SET TALK OFF
RELEASE WINDOW dummy

****************************************
Another example from Microsoft "How to display a progress bar in the status bar"
Code:
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

Mike Gagnon
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top