Bonsoirs à tous
Je me permet de revenir sur la question avec cette fois-ci un delta problème))
j'aimerais que la barre ne dépende plus d'un timer mais plutôt en fonction de la quantité de fichier à charger
mon bout de code n'est pas si mal mais présente quelque bug visuel dès l'instant où je monte la valeur
Total > 27, les distance entre les buchettes ne sont plus
respectés et n'en parlons même pas si l'on monte à 100
Mon objectif étant bien sûr de conserver mes belles petites buchettes régulières quelque soit le
Total attribué
Essayez sinon ce n'est pas si grave
en même temps c'est un défi comme un autre, moi, je bute dessus en tout cas
Code : Tout sélectionner
accre.l = 1
Total.l = 27
Ping.l = 64
#Buchette=15
#Barmax=405
#Buchmax=27
If OpenWindow(1, x, y, 500, 120, "Download", #PB_Window_MinimizeGadget|#PB_Window_BorderLess|#PB_Window_ScreenCentered)
String_0 = StringGadget(#PB_Any, 20, 50, 390, 20, "")
Button_Add = ButtonGadget(#PB_Any, 420, 50, 40, 20, "Go")
Button_Clear = ButtonGadget(#PB_Any, 460, 10, 40, 20, "End")
Text_0 = TextGadget(#PB_Any, 20, 10, 390, 30, "Windows 3.1")
Text_Ref = TextGadget(#PB_Any, 420, 80, 20, 20, "000")
Text_Slash = TextGadget(#PB_Any, 440, 80, 10, 20, "/")
Text_Total = TextGadget(#PB_Any, 450, 80, 20, 20, "000")
ProgressBar_0 = CanvasGadget(#PB_Any, 10, 80, 405, 20)
; AddWindowTimer(1,1,200)
SetGadgetText(Text_Total, RSet(Str(Total),3,"0"))
Repeat
Event = WaitWindowEvent()
WindowID = EventWindow()
GadgetID = EventGadget()
EventType = EventType()
Select Event
Case #PB_Event_Timer
; If EventTimer() = 1
;
;
;
; EndIf
Case #PB_Event_Gadget
Select GadgetID
Case Button_Add
vref.f = #Barmax/Total
vref2 = Int(Round(vref,#PB_Round_Up))
nbBuchette.f = vref/#Buchette
For Fichier = 1 To Total+1
For h=suite To vref2 * Fichier Step #Buchette
If h=203
h=210
EndIf
If StartDrawing(CanvasOutput(ProgressBar_0))
Box(h,0,13,20,$FF0000)
Delay(Ping/2)
StopDrawing()
EndIf
Debug h
Next h
If h > 405
h=405
EndIf
suite = (vref2 * Fichier);+15
accre = accre+1
If accre > Total
accre = Total
Break
EndIf
SetGadgetText(Text_Ref, "000")
SetGadgetText(Text_Ref, RSet(Str(accre),3,"0"))
Delay(Ping)
Next Fichier
Debug "Fin de chargement"
Case Button_Clear
Break
EndSelect
EndSelect
ForEver
End
Else
Debug "Erreur de chargement"
EndIf