Information générale
Catégorie:
Contrôles ActiveX en VFP
Titre:
How can i control the progress bar percentaje in a form?
hi friends!
I put a progress bar in a system. a also have some controls in this form. The idea of the system is to control the time of connections of
certain PCs to the Internet. The problem is that i want to make the
progressbar.value advance in percentage according to the time( minutes) especificated in a text control, which value is the minutes to rent(total amount).
therefore, the percentage of the progressbar will depend of the amount of minutes of the textcontrol value, but i do not know how to make this
work. heres the code for you can have an idea of what i am doing:
' this is the textcontrol keypress event
LPARAMETERS nKeyCode, nShiftAltCtrl
IF nKeyCode = 13 then
thisform.minutos.enabled = .f. 'minutes to get from client
thisform.conteo.enabled = .f. 'counter
thisform.command1.enabled = .f. 'start count button
NOTE else
thisform.reloj.enabled=.t. 'timer to count every minute
thisform.avanzar.enabled = .t.
' another timer(named avanzar ) to make the progress bar advance
NOTE avanza = thisform.conteo.value
NOTE for te= 1 to avanza
NOTE thisform.barra.value = avanza
NOTE endfor
&& thisform.tiempo = 15 - thisform.minutos.value
WITH thisform
.command4.enabled = .f.
.command1.enabled = .f.
ENDWITH
thisform.renta = val (thisform.minutos.value)
thisform.porciento.caption = "Avanzando..."
reglatres = ( thisform.tiempo * 60000 ) / 1
*thisform.avanzador = reglatres && esta var me conserva el valor
&& del texto en milsegundos
ENDIF
' the text control validation is some like this:
&&IF thisform.text1.value < 1 then &&.and. thisform.text1.value > 15 then
STORE val ( thisform.minutos.value) to comparador
DO case
CASE comparador < 1 && esta comparacion es tonta pero buena
MESSAGEBOX("No se permite este valor para este control",16,"Advertencia General")
thisform.minutos.value =""
CASE comparador > 15 &&segunda comparacion maje
MESSAGEBOX("No se permite este valor para este control",16,"Advertencia General")
thisform.minutos.value =""
thisform.minutos.enabled = .t.
thisform.conteo.enabled = .f.
thisform.command1.enabled = .f.
thisform.reloj.enabled=.f.
thisform.renta = val (thisform.minutos.value)
thisform.porciento.caption = ""
OTHERWISE
thisform.minutos.enabled = .f.
thisform.minutos.value = 0
ENDCASE
here is the timer event
xyz=thisform.tiempo
IF xyz => thisform.renta
FOR temp= 1 to 100 && para simular el final del tiempo en la barra
thisform.barra.value = temp && aqui pasa rapido
thisform.porciento.caption = "%"+str(temp)
ENDFOR
SET bell to 'arabia.wav'
?? CHR(7)
=messagebox("Su Tiempo ha Terminado!",0,"Control de Tiempo de llamada")
totales = str(xyz * 2,4)
=messagebox("El total a pagar es : "+totales,0,"TOTAL A PAGAR: ")
STORE 1 to thisform.tiempo
STORE 0 to xyz,totales
WITH thisform
.minutos.value = ""
.conteo.value = ""
.total.value = ""
.command1.enabled = .f.
.barra.value = 0
.command2.enabled = .f.
.minutos.enabled = .t.
.porciento.enabled = .f.
.porciento.visible = .f.
.reloj.enabled = .f.
ENDWITH
ELSE
thisform.total.value = (xyz+1) * 2
thisform.tiempo=thisform.tiempo+1
thisform.conteo.value=thisform.tiempo
FOR te = 1 to xyz * 7
thisform.barra.value = te && xyz +1
thisform.porciento.caption = "%"+str(te)
ENDFOR
ENDIF
' timer avanzar
' another timer for make the progressbar advance is some like this:?
thisform.avanzador = thisform.avanzador +1
FOR n = 1 to thisform.avanzador
thisform.barra.value = n && aqui pasa rapido
thisform.porciento.caption = "%"+str(n)
ENDFOR
where thisform.avanzador is a porperty of the form (started at 1) in which i store the
amount of percentage i want the progress bar to present everytime the timer event suceed. this is one of main part of the problem!
the interval of this timer is 500
let me know friends!
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement