ProgressBarGadget bug

Just starting out? Need help? Post your questions and find answers here.
User avatar
SPH
Enthusiast
Enthusiast
Posts: 269
Joined: Tue Jan 04, 2011 6:21 pm

ProgressBarGadget bug

Post by SPH »

Chez moi, ce code fini pas bugguer tot ou tard(- de 1 minute)
Egalement, il buggue quand il perd le focus et le retrouve
Le beep_() est la pour prouver que la routine continue a boucler et que c'est les ProgressBarGadget qui s'arretent de se dessiner...

Code: Select all

If OpenWindow(0, 0, 0, 320, 160, "ProgressBarGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) 
  
 Repeat 
    i+1
    i%100
    ProgressBarGadget(0,  10, 30, 250,  30, 0, 100)
    SetGadgetState   (0, i)   ;  change la valeur de la 1ère barre de progression (ID = 0) à 50 sur 100
    j+1
    j%182
    ProgressBarGadget(1,  10, 90, 250,  30, 0, 182, #PB_ProgressBar_Smooth)
    SetGadgetState   (1, j)   ;  change la valeur de la 2ème barre de progression (ID = 1) à 50 sur 200
    k+1
    k%217
    ProgressBarGadget(2, 270, 10,  30, 120, 0, 217, #PB_ProgressBar_Vertical)
    SetGadgetState   (2, k)   ; change la valeur de la 3ème barre de progression (ID = 2) à 100 sur 300
    
    If i=0
      Beep_(1500,50)
    EndIf
    
    Delay(5)
ForEver

EndIf
Avec des gadgets en dehors de la boucle événementielle, ca ne va pas mieux.
Voici un logiciel qui buggue :

Code: Select all

UseJPEGImageEncoder()
UseJPEGImageDecoder()
UseGIFImageDecoder()
UsePNGImageDecoder()


OpenWindow(0, 0, 0, 749, 486+12, "ImageGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)

If LoadImage(0, "c:\SPH\PB\titre.bmp")    ; changez le 2ème paramètre en indiquant le chemin/fichier contenant votre image
  ImageGadget(0,  10, 10, 728, 53, ImageID(0))                      ; imagegadget standard
EndIf

Global Repertoire$
calcul=0

ExplorerTreeGadget(1, 11, 73, 360, 300, Repertoire$, #PB_Explorer_NoFiles)
ExplorerListGadget(2, 377,73,360,300, "*.jpg;*.jpeg;*.bmp;*.gif;*.png", #PB_Explorer_NoFolders|#PB_Explorer_NoParentFolder)

FrameGadget(3, 11,  380, 727,65, "", #PB_Frame_Single)

;titre
TextGadget(4, 20, 388,90,20,"Titre de la page :")
StringGadget(5, 20,  410, 150, 20, "")

;vignettes
CheckBoxGadget(6, 200,  388, 70, 20, " Vignettes :")
SetGadgetState(6, #PB_Checkbox_Checked)
TrackBarGadget(8, 200, 410, 180, 25, 0, 12, #PB_TrackBar_Ticks)
SetGadgetState(8, 6)
TextGadget(7, 285,  391, 95, 17, Str(37+GetGadgetState(8)*16)+" pixels de large")

;colonnes
TextGadget(9, 410, 388,50,20,"Colonnes :")
SpinGadget     (10, 410, 410, 45, 25, 1, 100)
SetGadgetState (10, 8) : SetGadgetText(10, "8")   ; définit la valeur initiale

;papier peint
CheckBoxGadget(11, 490,  388, 80, 20, " Papier peint :")
SetGadgetState(11, #PB_Checkbox_Checked)
ButtonGadget(13, 500,  412, 70, 18, "Couleur")
;14 image fong.gif
If CreateImage(14, 32,32) And StartDrawing(ImageOutput(14))
  For x = 0 To 31
    For y = 0 To 31
      Plot(X, Y, RGB(255,255,255))
    Next y
  Next x
  StopDrawing() 
  ImageGadget(14, 580, 394, 32, 32, ImageID(14))
EndIf

;visualiser
CheckBoxGadget(15, 650,  388, 80, 20, " Visualiser")
SetGadgetState(15, #PB_Checkbox_Checked)

;generer le html
ButtonGadget(16, 10,  450+15, 729, 28, "Générer la page")

;progressbar
ProgressBarGadget(17,  110, 453, 529,  8, 0, 100)


;ImageGadget(0,  10, 10, 728, 53, ImageID(0))                      ; imagegadget standard

Procedure Afficher_fichiers()
  SetGadgetText(2, "")                    ; Vider la liste des fichiers
  Repertoire$ = GetGadgetText(1)          ; Voir quel est le répertoire sélectionné 
  SetGadgetText(2, Repertoire$)           ; Remplir la liste avec le répertoire
EndProcedure

; Si clic gauche sur l'arbre ou déplacement avec les flèches, alors afficher les fichiers dans la fenêtre liste fichiers
BindGadgetEvent(1, @Afficher_fichiers(), #PB_EventType_Change) ; #PB_EventType_LeftClick) 

;Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow



Repeat
  Evenement = WaitWindowEvent()
  If Evenement = #PB_Event_Gadget
    
    
    If EventGadget() = 10
      SetGadgetText(10,Str(GetGadgetState(10)))
    EndIf
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    If EventGadget() = 8 ;Il faut indiquer le bon gadget
      SetGadgetText(7, Str(37+GetGadgetState(8)*16)+" pixels de large")
    EndIf
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    If EventGadget() = 13
      couleur=ColorRequester()
      r=Red(couleur)
      v=Green(couleur)
      b=Blue(couleur)
      Restore fond
      If StartDrawing(ImageOutput(14)); And couleur>=0
        For u=0 To 31
          For i=0 To 31
            Read.b  c.b
            
            If c=1
              
              If r=255
                rr=r-Random(50)
              Else
                rr=r+Random(50)
              EndIf
              If v=255
                vv=v-Random(50)
              Else
                vv=v+Random(50)
              EndIf
              If b=255
                bb=b-Random(50)
              Else
                bb=b+Random(50)
              EndIf
              Plot(i,u,RGB(rr,vv,bb))
              
            Else
              
              If r>235
                rr=r-10-Random(50)
              Else
                rr=r+10+Random(50)
              EndIf
              If v>235
                vv=v-10-Random(50)
              Else
                vv=v+10+Random(50)
              EndIf
              If b>235
                bb=b-10-Random(50)
              Else
                bb=b+10+Random(50)
              EndIf
              Plot(i,u,RGB(rr,vv,bb))
            EndIf
          Next
        Next
        StopDrawing() 
        ImageGadget(14, 580, 394, 32, 32, ImageID(14))
      EndIf
    EndIf
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    If EventGadget() = 16 And calcul=0
      
      calcul=1
      cmb=0
      
      If ExamineDirectory(0, Repertoire$, "*.*")  
        
        If CreateFile(0, Repertoire$+"index.html")
        Else
          MessageRequester("Erreur","Fabrication HTML impossible") : End 
        EndIf
        
        WriteStringN(0,"<!doctype html>")
        WriteStringN(0,"<html lang="+Chr(34)+"fr"+Chr(34)+">")
        WriteStringN(0,"<head>")
        WriteStringN(0,"<title>"+GetGadgetText(5)+"</title>")
        WriteStringN(0,"<meta http-equiv="+Chr(34)+"X-UA-Compatible"+Chr(34)+" content="+Chr(34)+"IE=edge"+Chr(34)+">")
        WriteStringN(0,"<meta charset="+Chr(34)+"utf-8"+Chr(34)+" />")
        WriteStringN(0,"</head>")
        WriteStringN(0,"<body background="+Chr(34)+"fond.gif"+Chr(34)+">")
        WriteStringN(0,"<center>")
        
        
        nombre=0
        While NextDirectoryEntry(0)
           If DirectoryEntryType(0) = #PB_DirectoryEntry_File
             file$= DirectoryEntryName(0)
             ; debug file$
            a$=Right(file$,5)
            Position = FindString(a$,".")
            If position<>0
              type$=Right(a$,5-position)
              ; debug type$
              
              If (LCase(type$)="jpg" Or LCase(type$)="jpeg" Or LCase(type$)="bmp" Or LCase(type$)="gif" Or LCase(type$)="png") And LCase(file$)<>"fond.gif"
                nombre+1
              EndIf
            EndIf
          EndIf
        Wend
        FinishDirectory(0)
        ; debug nombre
        
        
;        ProgressBarGadget(16,  110, 453, 529,  22, 0, nombre)
;        ProgressBarGadget(16,  110, 453, 529,  22, 0, nombre, #PB_ProgressBar_Smooth)
        nombre2=0
                 
        ;;;;;;;;;;;;
        
        ExamineDirectory(0, Repertoire$, "*.*")
        
         While NextDirectoryEntry(0)
          If DirectoryEntryType(0) = #PB_DirectoryEntry_File
            file$= DirectoryEntryName(0)
            ; debug file$
            ;;;
            TextGadget(0,250,20,  391, 40, file$);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
            ;;;
            
            a$=Right(file$,5)
            Position = FindString(a$,".")
            If position<>0
              type$=Right(a$,5-position)
              ; debug type$
              
              gadgetX=37+GetGadgetState(8)*16
              
              If (LCase(type$)="jpg" Or LCase(type$)="jpeg" Or LCase(type$)="bmp" Or LCase(type$)="gif" Or LCase(type$)="png") And LCase(file$)<>"fond.gif"
                
                If GetGadgetState(6)<>0
                  If wwww=0
                    CreateDirectory(Repertoire$+"mini")
                    wwww=1
                  EndIf
                  LoadImage(0,Repertoire$+file$)
                  CopyImage(0,1)
                  ;;;;;;;;;;;
                  imagex=ImageWidth(0)
                  imagey=ImageHeight(0)
                  If imagex>imagey
                    imx=gadgetX
                    imy=imagey*imx/imagex
                    
                  Else
                    imy=gadgetX
                    imx=imagex*imy/imagey
                    
                  EndIf
                  ;;;;;;;;;;;
                  ResizeImage(1, imx,imy)
                  SaveImage(1,Repertoire$+"mini/"+file$,#PB_ImagePlugin_JPEG)
                  FreeImage(1)
                EndIf
                
                WriteStringN(0,"<td align=center valign=center>")
                WriteStringN(0,"<a href="+Chr(34)+file$+Chr(34)+" target="+Chr(34)+"_blank"+Chr(34)+">")
                WriteStringN(0,"<img src="+Chr(34)+"mini/"+file$+Chr(34)+" border=1></a>")
                WriteStringN(0,"</td>")
                
                nombre2+1
                SetGadgetState (17,nombre2*100/nombre)
                
                cmb+1
                If cmb>=GetGadgetState(10)
                  cmb=0
                  WriteStringN(0,"<br />")
                EndIf
                
              EndIf
              
            EndIf
            
          EndIf
          
        Wend
        FinishDirectory(0)
        
        WriteStringN(0,"<br />")
        WriteStringN(0,"</body>")
        WriteStringN(0,"</html>")
        CloseFile(0)
        
      EndIf
      
      SaveImage(14, Repertoire$+"fond.gif")
      If GetGadgetState(15)<>0
        RunProgram( Repertoire$+"index.html")
      EndIf
      
      ;ButtonGadget(16, 10,  450, 729, 28, "Générer la page")
      calcul=0
    EndIf
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
  EndIf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,2,2,2,2,2,2,2,2,1,1
  Data .b 1,1,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,1,1
  Data .b 1,1,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,1,1
  Data .b 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
  Data .b 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
EndDataSection
http://HexaScrabble.com/
!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Portable LENOVO ideapad 110-17ACL 64 bits
Version de PB : 5.73LTS - 32 bits
walbus
Addict
Addict
Posts: 929
Joined: Sat Mar 02, 2013 9:17 am

Re: ProgressBarGadget bug

Post by walbus »

Je regardais seulement votre premier code et fait un petit changement

Code: Select all

If OpenWindow(0, 0, 0, 320, 160, "ProgressBarGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) 
  AddWindowTimer(0, 1, 100)
  ProgressBarGadget(0,  10, 30, 250,  30, 0, 100)
  ProgressBarGadget(1,  10, 90, 250,  30, 0, 182)
  ProgressBarGadget(2, 270, 10,  30, 120, 0, 217, #PB_ProgressBar_Vertical)
  Repeat 
    i+1 : i%100
    j+1 : j%182
    k+1 : k%217
    window_event=WaitWindowEvent(5)
    If window_event=#PB_Event_Timer And EventTimer()=1
    SetGadgetState   (0, i)   ; change la valeur de la 1ère barre de progression (ID = 0) à 50 sur 100
    SetGadgetState   (1, j)   ; change la valeur de la 2ème barre de progression (ID = 1) à 50 sur 200
    SetGadgetState   (2, k)   ; change la valeur de la 3ème barre de progression (ID = 2) à 100 sur 300
    EndIf
    If i=0
      Beep_(1500,50)
    EndIf
    If window_event=#PB_Event_CloseWindow : Break : EndIf
  ForEver
EndIf
User avatar
SPH
Enthusiast
Enthusiast
Posts: 269
Joined: Tue Jan 04, 2011 6:21 pm

Re: ProgressBarGadget bug

Post by SPH »

Meme s'il est sale, mon premier code ne devrait pas planter ! Il y a bien un bug de pb...

Code: Select all

If OpenWindow(0, 0, 0, 320, 160, "ProgressBarGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) 
  
 Repeat 
    i+1
    i%100
    ProgressBarGadget(0,  10, 30, 250,  30, 0, 100)
    SetGadgetState   (0, i)   ;  change la valeur de la 1ère barre de progression (ID = 0) à 50 sur 100
    j+1
    j%182
    ProgressBarGadget(1,  10, 90, 250,  30, 0, 182, #PB_ProgressBar_Smooth)
    SetGadgetState   (1, j)   ;  change la valeur de la 2ème barre de progression (ID = 1) à 50 sur 200
    k+1
    k%217
    ProgressBarGadget(2, 270, 10,  30, 120, 0, 217, #PB_ProgressBar_Vertical)
    SetGadgetState   (2, k)   ; change la valeur de la 3ème barre de progression (ID = 2) à 100 sur 300
    
    If i=0
      Beep_(1500,50)
    EndIf
    
    Delay(5)
ForEver

EndIf
http://HexaScrabble.com/
!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Portable LENOVO ideapad 110-17ACL 64 bits
Version de PB : 5.73LTS - 32 bits
User avatar
SPH
Enthusiast
Enthusiast
Posts: 269
Joined: Tue Jan 04, 2011 6:21 pm

Re: ProgressBarGadget bug

Post by SPH »

Je viens de passer l'apres midi a bidouiller mon code. J'ai enlevé le ProgressBarGadget et j'en ai fabriqué un 100% pb.
Et bien, ca plante quand je m'attaque a des dossiers bien fournis en image.
J'ai meme viré toute la partie html pour voir si ca ne venait pas de la. Non, ca bggue quand meme.
J'ai mis Evenement = WaitWindowEvent(1000) mais rien n'y fait.

Donc, il y a un bug mais je ne sais pas ou. Un truc interessant : quand je perd le focus et que je le remet, la barre de progression (que j'ai codé moi meme je le rappelle) bloque mais le calcul des mini images se fait quand meme !

J'en appelle a César (Fred)

Code: Select all

UseJPEGImageEncoder()
UseJPEGImageDecoder()
UseGIFImageDecoder()
UsePNGImageDecoder()


OpenWindow(0, 0, 0, 749, 486+12, "ImageGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)

If LoadImage(0, "c:\SPH\PB\titre.bmp")    ; changez le 2ème paramètre en indiquant le chemin/fichier contenant votre image
  ImageGadget(0,  10, 10, 728, 53, ImageID(0))                      ; imagegadget standard
EndIf

Global Repertoire$
calcul=0

ExplorerTreeGadget(1, 11, 73, 360, 300, Repertoire$, #PB_Explorer_NoFiles)
ExplorerListGadget(2, 377,73,360,300, "*.jpg;*.jpeg;*.bmp;*.gif;*.png", #PB_Explorer_NoFolders|#PB_Explorer_NoParentFolder)

FrameGadget(3, 11,  380, 727,65, "", #PB_Frame_Single)

;titre
TextGadget(4, 20, 388,90,20,"Titre de la page :")
StringGadget(5, 20,  410, 150, 20, "")

;vignettes
CheckBoxGadget(6, 200,  388, 70, 20, " Vignettes :")
SetGadgetState(6, #PB_Checkbox_Checked)
TrackBarGadget(8, 200, 410, 180, 25, 0, 12, #PB_TrackBar_Ticks)
SetGadgetState(8, 6)
TextGadget(7, 285,  391, 95, 17, Str(37+GetGadgetState(8)*16)+" pixels de large")

;colonnes
TextGadget(9, 410, 388,50,20,"Colonnes :")
SpinGadget     (10, 410, 410, 45, 25, 1, 100)
SetGadgetState (10, 8) : SetGadgetText(10, "8")   ; définit la valeur initiale

;papier peint
CheckBoxGadget(11, 490,  388, 80, 20, " Papier peint :")
SetGadgetState(11, #PB_Checkbox_Checked)
ButtonGadget(13, 500,  412, 70, 18, "Couleur")
;14 image fong.gif
If CreateImage(14, 32,32) And StartDrawing(ImageOutput(14))
  For x = 0 To 31
    For y = 0 To 31
      Plot(X, Y, RGB(255,255,255))
    Next y
  Next x
  StopDrawing() 
  ImageGadget(14, 580, 394, 32, 32, ImageID(14))
EndIf

;visualiser
CheckBoxGadget(15, 650,  388, 80, 20, " Visualiser")
SetGadgetState(15, #PB_Checkbox_Checked)

;generer le html
ButtonGadget(16, 10,  450+15, 729, 28, "Générer la page")

;progressbar
;ProgressBarGadget(17,  110, 453, 529,  8, 0, 100)
CreateImage(17, 329,8)
      StartDrawing(ImageOutput(17))
      ;Debug Str(z)+"   "+Str(nombre2*328/nombre)
      For x = 0 To 328
        For y = 0 To 7
          Plot(x, Y, RGB(100+Random(50),40+Random(20),40+Random(20)))
        Next y
      Next x
      StopDrawing() 
ImageGadget(17,  210, 453, 329, 8, ImageID(17))


;ImageGadget(0,  10, 10, 728, 53, ImageID(0))                      ; imagegadget standard

Procedure Afficher_fichiers()
  SetGadgetText(2, "")                    ; Vider la liste des fichiers
  Repertoire$ = GetGadgetText(1)          ; Voir quel est le répertoire sélectionné 
  SetGadgetText(2, Repertoire$)           ; Remplir la liste avec le répertoire
EndProcedure

; Si clic gauche sur l'arbre ou déplacement avec les flèches, alors afficher les fichiers dans la fenêtre liste fichiers
BindGadgetEvent(1, @Afficher_fichiers(), #PB_EventType_Change) ; #PB_EventType_LeftClick) 

;Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow



Repeat
  Evenement = WaitWindowEvent(1000)
  If Evenement = #PB_Event_Gadget And calcul=0
    
CreateImage(17, 329,8)
      StartDrawing(ImageOutput(17))
      For x = 0 To 328
        For y = 0 To 7
          Plot(x, Y, RGB(100+Random(50),40+Random(20),40+Random(20)))
        Next y
      Next x
      StopDrawing() 
ImageGadget(17,  210, 453, 329, 8, ImageID(17))

    
    If EventGadget() = 10 And calcul=0
      SetGadgetText(10,Str(GetGadgetState(10)))
    EndIf
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    If EventGadget() = 8 And calcul=0
      SetGadgetText(7, Str(37+GetGadgetState(8)*16)+" pixels de large")
    EndIf
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    If EventGadget() = 13 And calcul=0
      couleur=ColorRequester()
      r=Red(couleur)
      v=Green(couleur)
      b=Blue(couleur)
      Restore fond
      If StartDrawing(ImageOutput(14)); And couleur>=0
        For u=0 To 31
          For i=0 To 31
            Read.b  c.b
            
            If c=1
              
              If r=255
                rr=r-Random(50)
              Else
                rr=r+Random(50)
              EndIf
              If v=255
                vv=v-Random(50)
              Else
                vv=v+Random(50)
              EndIf
              If b=255
                bb=b-Random(50)
              Else
                bb=b+Random(50)
              EndIf
              Plot(i,u,RGB(rr,vv,bb))
              
            Else
              
              If r>235
                rr=r-10-Random(50)
              Else
                rr=r+10+Random(50)
              EndIf
              If v>235
                vv=v-10-Random(50)
              Else
                vv=v+10+Random(50)
              EndIf
              If b>235
                bb=b-10-Random(50)
              Else
                bb=b+10+Random(50)
              EndIf
              Plot(i,u,RGB(rr,vv,bb))
            EndIf
          Next
        Next
        StopDrawing() 
        ImageGadget(14, 580, 394, 32, 32, ImageID(14))
      EndIf
    EndIf
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    If EventGadget() = 16 And calcul=0
      
      calcul=1
      cmb=0
      z=0
      
      If ExamineDirectory(0, Repertoire$, "*.*")  
        
        If CreateFile(0, Repertoire$+"index.html")
        Else
          MessageRequester("Erreur","Fabrication HTML impossible") : End 
        EndIf
        
        WriteStringN(0,"<!doctype html>")
        WriteStringN(0,"<html lang="+Chr(34)+"fr"+Chr(34)+">")
        WriteStringN(0,"<head>")
        WriteStringN(0,"<title>"+GetGadgetText(5)+"</title>")
        WriteStringN(0,"<meta http-equiv="+Chr(34)+"X-UA-Compatible"+Chr(34)+" content="+Chr(34)+"IE=edge"+Chr(34)+">")
        WriteStringN(0,"<meta charset="+Chr(34)+"utf-8"+Chr(34)+" />")
        WriteStringN(0,"</head>")
        WriteStringN(0,"<body background="+Chr(34)+"fond.gif"+Chr(34)+">")
        WriteStringN(0,"<center>")
        
        
        nombre=0
        While NextDirectoryEntry(0)
           If DirectoryEntryType(0) = #PB_DirectoryEntry_File
             file$= DirectoryEntryName(0)
             ; debug file$
            a$=Right(file$,5)
            Position = FindString(a$,".")
            If position<>0
              type$=Right(a$,5-position)
              ; debug type$
              
              If (LCase(type$)="jpg" Or LCase(type$)="jpeg" Or LCase(type$)="bmp" Or LCase(type$)="gif" Or LCase(type$)="png") And LCase(file$)<>"fond.gif"
                nombre+1
              EndIf
            EndIf
          EndIf
        Wend
        FinishDirectory(0)
        ; debug nombre
        
        
;        ProgressBarGadget(16,  110, 453, 529,  22, 0, nombre)
;        ProgressBarGadget(16,  110, 453, 529,  22, 0, nombre, #PB_ProgressBar_Smooth)
        nombre2=0
                 
        ;;;;;;;;;;;;
        
        ExamineDirectory(0, Repertoire$, "*.*")
        
         While NextDirectoryEntry(0)
          If DirectoryEntryType(0) = #PB_DirectoryEntry_File
            file$= DirectoryEntryName(0)
            ; debug file$
            ;;;
            TextGadget(0,250,20,  391, 40, file$);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
            ;;;
            
            a$=Right(file$,5)
            Position = FindString(a$,".")
            If position<>0
              type$=Right(a$,5-position)
              ; debug type$
              
              gadgetX=37+GetGadgetState(8)*16
              
              If (LCase(type$)="jpg" Or LCase(type$)="jpeg" Or LCase(type$)="bmp" Or LCase(type$)="gif" Or LCase(type$)="png") And LCase(file$)<>"fond.gif"
                
                If GetGadgetState(6)<>0
                  If wwww=0
                    CreateDirectory(Repertoire$+"mini")
                    wwww=1
                  EndIf
                  LoadImage(0,Repertoire$+file$)
                  CopyImage(0,1)
                  ;;;;;;;;;;;
                  imagex=ImageWidth(0)
                  imagey=ImageHeight(0)
                  If imagex>imagey
                    imx=gadgetX
                    imy=imagey*imx/imagex
                    
                  Else
                    imy=gadgetX
                    imx=imagex*imy/imagey
                    
                  EndIf
                  ;;;;;;;;;;;
                  ResizeImage(1, imx,imy)
                  SaveImage(1,Repertoire$+"mini/"+file$,#PB_ImagePlugin_JPEG)
                  FreeImage(1)
                EndIf
                
                WriteStringN(0,"<td align=center valign=center>")
                WriteStringN(0,"<a href="+Chr(34)+file$+Chr(34)+" target="+Chr(34)+"_blank"+Chr(34)+">")
                WriteStringN(0,"<img src="+Chr(34)+"mini/"+file$+Chr(34)+" border=1></a>")
                WriteStringN(0,"</td>")
                
                nombre2+1
                ;SetGadgetState (17,nombre2*100/nombre)
                
      StartDrawing(ImageOutput(17))
      ;Debug Str(z)+"   "+Str(nombre2*328/nombre)
      For x = z To nombre2*328/nombre
        For y = 0 To 7
          Plot(x, Y, RGB(20+Random(30),200+Random(55),20+Random(30)))
        Next y
      Next x
      z=nombre2*328/nombre
      StopDrawing() 
      
      ;ImageGadget(0, 0, 0, 200, 200, ImageID(0))
      ImageGadget(17,  210, 453, 329, 8, ImageID(17))
      ;ProgressBarGadget(17,  110, 453, 529,  8, 0, 100)
                
                
                cmb+1
                If cmb>=GetGadgetState(10)
                  cmb=0
                  WriteStringN(0,"<br />")
                EndIf
                
              EndIf
              
            EndIf
            
          EndIf
          
        Wend
        FinishDirectory(0)
        
        WriteStringN(0,"<br />")
        WriteStringN(0,"</body>")
        WriteStringN(0,"</html>")
        CloseFile(0)
        
      EndIf
      
      SaveImage(14, Repertoire$+"fond.gif")
      If GetGadgetState(15)<>0
        RunProgram( Repertoire$+"index.html")
      EndIf
      
      ;ButtonGadget(16, 10,  450, 729, 28, "Générer la page")
      calcul=0
    EndIf
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
  EndIf
Until Evenement = #PB_Event_CloseWindow
End

;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;

DataSection
  fond:
  Data .b 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1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,2,2,1,1
  Data .b 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
  Data .b 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
EndDataSection
http://HexaScrabble.com/
!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Portable LENOVO ideapad 110-17ACL 64 bits
Version de PB : 5.73LTS - 32 bits
User avatar
Demivec
Addict
Addict
Posts: 4091
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: ProgressBarGadget bug

Post by Demivec »

What is the bug being reported?

My only guess is that a proper event loop is not being used.

The event queue should be emptied before moving on.

Code: Select all

If OpenWindow(0, 0, 0, 320, 160, "ProgressBarGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) 
  
 Repeat 
    i+1
    i%100
    ProgressBarGadget(0,  10, 30, 250,  30, 0, 100)
    SetGadgetState   (0, i)   ;  change la valeur de la 1ère barre de progression (ID = 0) à 50 sur 100
    j+1
    j%182
    ProgressBarGadget(1,  10, 90, 250,  30, 0, 182, #PB_ProgressBar_Smooth)
    SetGadgetState   (1, j)   ;  change la valeur de la 2ème barre de progression (ID = 1) à 50 sur 200
    k+1
    k%217
    ProgressBarGadget(2, 270, 10,  30, 120, 0, 217, #PB_ProgressBar_Vertical)
    SetGadgetState   (2, k)   ; change la valeur de la 3ème barre de progression (ID = 2) à 100 sur 300
    
    window_event = WaitWindowEvent(5) ;changing the progressbar's will always cause this to catch an event
    While window_event <> 0
      If window_event = #PB_Event_CloseWindow : Break 2: EndIf
      window_event = WindowEvent()
    Wend
    If i=0
      Beep_(1500,50)
    EndIf
    
    Delay(5)
ForEver

EndIf
walbus
Addict
Addict
Posts: 929
Joined: Sat Mar 02, 2013 9:17 am

Re: ProgressBarGadget bug

Post by walbus »

@Demivec
He mean PB must also work with unclean codes !
Last edited by walbus on Fri Jun 09, 2017 7:27 am, edited 1 time in total.
User avatar
falsam
Enthusiast
Enthusiast
Posts: 630
Joined: Wed Sep 21, 2011 9:11 am
Location: France
Contact:

Re: ProgressBarGadget bug

Post by falsam »

SPH wrote:Il y a bien un bug de pb...
The only bug is you. ^_^
Walbus gave you the solution!
Demivec wrote:My only guess is that a proper event loop is not being used.
Yes

➽ Windows 11 64-bit - PB 6.0 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti

Sorry for my bad english and the Dunning–Kruger effect.
User avatar
falsam
Enthusiast
Enthusiast
Posts: 630
Joined: Wed Sep 21, 2011 9:11 am
Location: France
Contact:

Re: ProgressBarGadget bug

Post by falsam »

The solution is to use threads. A French example on this link.
:arrow: http://www.purebasic.fr/french/viewtopi ... 85#p193185

➽ Windows 11 64-bit - PB 6.0 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti

Sorry for my bad english and the Dunning–Kruger effect.
walbus
Addict
Addict
Posts: 929
Joined: Sat Mar 02, 2013 9:17 am

Re: ProgressBarGadget bug

Post by walbus »

falsam wrote : The only bug is you. ^_^
@SPH
Unfortunately, yes, your problem is only you
Sorry, but I've rarely seen such bad and ugly code as yours
Last edited by walbus on Fri Jun 09, 2017 1:03 pm, edited 1 time in total.
User avatar
SPH
Enthusiast
Enthusiast
Posts: 269
Joined: Tue Jan 04, 2011 6:21 pm

Re: ProgressBarGadget bug

Post by SPH »

walbus wrote:falsmam wrote : The only bug is you. ^_^
@SPH
Unfortunately, yes, your problem is only you
Sorry, but I've rarely seen such bad and ugly code as yours
Thxxx :mrgreen:
http://HexaScrabble.com/
!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Portable LENOVO ideapad 110-17ACL 64 bits
Version de PB : 5.73LTS - 32 bits
User avatar
SPH
Enthusiast
Enthusiast
Posts: 269
Joined: Tue Jan 04, 2011 6:21 pm

Re: ProgressBarGadget bug

Post by SPH »

Code: Select all

If OpenWindow(0, 0, 0, 320, 160, "ProgressBarGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) 
  
 Repeat 
    i+1
    i%100
    ProgressBarGadget(0,  10, 30, 250,  30, 0, 100)
    SetGadgetState   (0, i)   ;  change la valeur de la 1ère barre de progression (ID = 0) à 50 sur 100
    j+1
    j%182
    ProgressBarGadget(1,  10, 90, 250,  30, 0, 182, #PB_ProgressBar_Smooth)
    SetGadgetState   (1, j)   ;  change la valeur de la 2ème barre de progression (ID = 1) à 50 sur 200
    k+1
    k%217
    ProgressBarGadget(2, 270, 10,  30, 120, 0, 217, #PB_ProgressBar_Vertical)
    SetGadgetState   (2, k)   ; change la valeur de la 3ème barre de progression (ID = 2) à 100 sur 300
    
    If i=0
      Beep_(1500,50)
    EndIf
    
    Delay(5)
ForEver

EndIf
Je fais le point : ce code buggue meme s'il est mal ecrit.
Quand a mon long code, j'ai trouvé ce qui clochait et ce n'est pas un bug de progressBar...

merci :oops:
http://HexaScrabble.com/
!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Portable LENOVO ideapad 110-17ACL 64 bits
Version de PB : 5.73LTS - 32 bits
G-Rom
User
User
Posts: 45
Joined: Sat Mar 19, 2011 3:49 pm
Contact:

Re: ProgressBarGadget bug

Post by G-Rom »

Code: Select all

...
Repeat 
ProgressBarGadget(...
Delay(5)
ForEver
...
Every 5 ms you create a new "gadget" bro... , stop beer and reality show on your tv ;)
User avatar
SPH
Enthusiast
Enthusiast
Posts: 269
Joined: Tue Jan 04, 2011 6:21 pm

Re: ProgressBarGadget bug

Post by SPH »

G-Rom wrote:

Code: Select all

...
Repeat 
ProgressBarGadget(...
Delay(5)
ForEver
...
Every 5 ms you create a new "gadget" bro... , stop beer and reality show on your tv ;)
Si ca ne plante pas lors du premier passage, ca ne devrait pas planter du tout.
C'est un bug 8)
http://HexaScrabble.com/
!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Portable LENOVO ideapad 110-17ACL 64 bits
Version de PB : 5.73LTS - 32 bits
Post Reply