progressbargadget a l'envers

Vous débutez et vous avez besoin d'aide ? N'hésitez pas à poser vos questions
Avatar de l’utilisateur
venom
Messages : 3138
Inscription : jeu. 29/juil./2004 16:33
Localisation : Klyntar
Contact :

progressbargadget a l'envers

Message par venom »

bonjour,

voila ma question est simple est-ce qu'il est possible de faire fonctionner une progressbar a l'envers j'explique :wink: :

exemple je monte un trackbar de 0 a 100 la facile pour que la progressbar suit. :wink:

mais est il possible que quand je monte la trackbar et bien la progressbar elle dessand ?

pour mieu comprendre voici un petit bout de code :wink: .

Code : Tout sélectionner

;- Window Constants
Enumeration
  #Window_0
EndEnumeration

;- Gadget Constants
Enumeration
  #TrackBar_0
  #TrackBar_1
  #ProgressBar_0
  #ProgressBar_1
EndEnumeration

  If OpenWindow(#Window_0, 216, 0, 440, 70, "progbar",  #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_ScreenCentered )
    If CreateGadgetList(WindowID(#Window_0))
      TrackBarGadget(#TrackBar_0, 10, 10, 200, 20, 0, 100)
      TrackBarGadget(#TrackBar_1, 235, 10, 200, 20, 0, 100)
      ProgressBarGadget(#ProgressBar_0, 10, 45, 200, 15, 0, 100, #PB_ProgressBar_Smooth)
      ProgressBarGadget(#ProgressBar_1, 235, 45, 200, 15, 0, 100, #PB_ProgressBar_Smooth)
      SetGadgetState(#ProgressBar_1, 100)
      
      
    EndIf
  EndIf

  Repeat
   EventID = WaitWindowEvent()
    If EventID = #PB_Event_Gadget 
      Select EventGadget()
      
       Case #TrackBar_0
        Etat = GetGadgetState(#TrackBar_0)
        SetGadgetState(#ProgressBar_0, Etat)
       
       Case #TrackBar_1
      
      EndSelect
    EndIf
  Until EventID = #PB_Event_CloseWindow
.

voila d'avance merci



@++
Windows 10 x64, PureBasic 5.73 x86 & x64
GPU : radeon HD6370M, CPU : p6200 2.13Ghz
Ollivier
Messages : 4197
Inscription : ven. 29/juin/2007 17:50
Localisation : Encore ?
Contact :

Message par Ollivier »

8O

Code : Tout sélectionner

;- Window Constants 
Enumeration 
  #Window_0 
EndEnumeration 

;- Gadget Constants 
Enumeration 
  #TrackBar_0 
  #TrackBar_1 
  #ProgressBar_0 
  #ProgressBar_1 
EndEnumeration 

  If OpenWindow(#Window_0, 216, 0, 440, 70, "progbar",  #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_ScreenCentered ) 
    If CreateGadgetList(WindowID(#Window_0)) 
      TrackBarGadget(#TrackBar_0, 10, 10, 200, 20, 0, 100) 
      TrackBarGadget(#TrackBar_1, 235, 10, 200, 20, 0, 100) 
      ProgressBarGadget(#ProgressBar_0, 10, 45, 200, 15, 0, 100, #PB_ProgressBar_Smooth) 
      ProgressBarGadget(#ProgressBar_1, 235, 45, 200, 15, 0, 100, #PB_ProgressBar_Smooth) 
      SetGadgetState(#ProgressBar_1, 100) 
      
      
    EndIf 
  EndIf 

  SetGadgetState(#ProgressBar_0, 100) 
  Repeat 
   EventID = WaitWindowEvent() 
    If EventID = #PB_Event_Gadget 
      Select EventGadget() 
      
       Case #TrackBar_0 
        Etat = GetGadgetState(#TrackBar_0) 
        SetGadgetState(#ProgressBar_0, 100 - Etat) 
        
       Case #TrackBar_1 
      
      EndSelect 
    EndIf 
  Until EventID = #PB_Event_CloseWindow
:o
Avatar de l’utilisateur
venom
Messages : 3138
Inscription : jeu. 29/juil./2004 16:33
Localisation : Klyntar
Contact :

Message par venom »

:? c'etait si facile :oops: autant pour moi je me douter que c'etait qu'une simple operation mais je ne savais pas comment la réalisé meme si c'est tout bete :wink: .
merci



@++
Windows 10 x64, PureBasic 5.73 x86 & x64
GPU : radeon HD6370M, CPU : p6200 2.13Ghz
bernard13
Messages : 1221
Inscription : mer. 05/janv./2005 21:30

Message par bernard13 »

merci pour l'exemple
et comment faire pour bouger la barre automatiquent svp?
Ollivier
Messages : 4197
Inscription : ven. 29/juin/2007 17:50
Localisation : Encore ?
Contact :

Message par Ollivier »

Il faut préciser le mot «automatiquement».
Avatar de l’utilisateur
venom
Messages : 3138
Inscription : jeu. 29/juil./2004 16:33
Localisation : Klyntar
Contact :

Message par venom »

je ne sais pas si sa te convient mais j'ai ceux-ci

Code : Tout sélectionner

;- Window Constants
Enumeration
  #Window_0
EndEnumeration

;- Gadget Constants
Enumeration
  #ProgressBar_0
  #Button_0
EndEnumeration

  If OpenWindow(#Window_0, 216, 0, 319, 85, "New window ( 0 )",  #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_ScreenCentered )
    If CreateGadgetList(WindowID(#Window_0))
      ProgressBarGadget(#ProgressBar_0, 10, 10, 300, 15, 0, 100)
      ButtonGadget(#Button_0, 115, 40, 90, 25, "lancer")
      
    EndIf
  EndIf
  
  Repeat
   EventID = WaitWindowEvent()
    If EventID = #PB_Event_Gadget 
      Select EventGadget()
      
       Case #Button_0
        Beep_(1000, 100)
         SetGadgetState(#ProgressBar_0, 10)
          Delay(500)
        Beep_(1000, 100)
         SetGadgetState(#ProgressBar_0, 35)
          Delay(100)
        Beep_(1000, 100)
         SetGadgetState(#ProgressBar_0, 48)
          Delay(1000)
        Beep_(1000, 100)
         SetGadgetState(#ProgressBar_0, 64)
          Delay(100)
        Beep_(1000, 100)
         SetGadgetState(#ProgressBar_0, 88)
          Delay(800)
        Beep_(4000, 100)
         SetGadgetState(#ProgressBar_0, 100)
          Delay(800)
         End 
      
      EndSelect
    EndIf
  Until EventID = #PB_Event_CloseWindow

@++
Windows 10 x64, PureBasic 5.73 x86 & x64
GPU : radeon HD6370M, CPU : p6200 2.13Ghz
bernard13
Messages : 1221
Inscription : mer. 05/janv./2005 21:30

Message par bernard13 »

merci venom
Répondre