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 can I create a progressbar in a form?

Tips -N- Tricks

How can I create a progressbar in a form?

by  ChrisRChamberlain  Posted    (Edited  )
If you want to include your progress bar in a form, the following are the NON DEFAULT properties for the only two additional controls needed.

You will need to determine the position and size of txtProgressBar and make both controls [color blue].Visible = .T.[/color] during processing, and [color blue].Visible = .F.[/color] on [color blue]EXIT[/color]ing the loop.
[color blue]
WITH THISFORM.txtProgressBar
[tab].Alignment = 2
[tab].DisabledBackColor = RGB(255,25,255)
[tab].DisabledForeColor = RGB(0,0,0)
[tab].Enabled = .F.
[tab].TabStop = .F.
[tab].Visible = .F.
ENDWITH

WITH THISFORM.shpProgressBar
[tab].BackStyle = 0
[tab].BorderStyle = 0
[tab].DrawMode = 14
[tab].FillColor = RGB(0,0,128)
[tab].FillStyle = 0
[tab].Height = [/color][color green]&& Same as txtProgressBar[/color][color blue]
[tab].Top = [/color][color green]&& Same as txtProgressBar[/color][color blue]
[tab].Visible = .F.
[tab].Width = 1
ENDWITH
[/color]
The following code might be typical of table processing and needs including in your [color blue]SCAN...ENDS[/color] loop etc, where [color blue]lnCount[/color] is the number of records processed.
[color blue]
WITH THISFORM
[tab].txtProgressBar.Value = ;
[tab][tab]ALLTRIM(STR((lnCount / RECCOUNT(
)*100))) + [%]
[tab].shpProgressBar.Width = ;
[tab]lnCount * .txtProgressBar.Width / RECCOUNT(
)
ENDWITH[/color]

HTH

Chris [pc2]
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