It is currently Tue Jan 26, 2021 10:19 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Get start & end of TrackBar Readings
PostPosted: Sun Mar 22, 2020 8:32 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Sun Apr 12, 2009 6:27 am
Posts: 3838
Hi All
The title say it all
#1 :
Code:
Global Dim state(2)
 
If OpenWindow(0, 0, 0, 320, 200, "TrackBarGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  TrackBarGadget(1, 10, 10, 300, 40, 0, 30, #PB_TrackBar_Ticks)
     
AddWindowTimer(0,125,100)
Repeat
    Select WaitWindowEvent()
      Case #PB_Event_CloseWindow
        Quit = 1
       
      Case #PB_Event_Timer
        If GetActiveGadget() = 1
          state(i) = GetGadgetState(1)
          i+1
          If i > 2
            i = 1
          EndIf         
          If state(1) = state(2)
            i = 0
            SetActiveGadget(-1)
          EndIf
        EndIf

       
      Case #PB_Event_Gadget
        Select EventGadget()
          Case 1
            Debug state(0)
            Debug GetGadgetState(1)
        EndSelect
    EndSelect
Until Quit = 1
EndIf


#2 :
Code:
Global max
max = 30
Global Dim state(max+10)
 
If OpenWindow(0, 0, 0, 320, 200, "TrackBarGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  TrackBarGadget(1, 10, 10, 250, 40, 0, max, #PB_TrackBar_Ticks)
     
AddWindowTimer(0,125,10)
Repeat
    Select WaitWindowEvent()
      Case #PB_Event_CloseWindow
        Quit = 1
       
      Case #PB_Event_Timer
        If GetActiveGadget() = 1
          state(i) = GetGadgetState(1)
          i+1         
          If state(i) = state(i+10)
            i = 0
            SetActiveGadget(-1)
          EndIf
        EndIf

       
      Case #PB_Event_Gadget
        Select EventGadget()
          Case 1
            Debug state(0)
            Debug GetGadgetState(1)
        EndSelect
    EndSelect
Until Quit = 1
EndIf


#3 :
Code:
Global Dim state(2)
 
If OpenWindow(0, 0, 0, 320, 200, "TrackBarGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  TrackBarGadget(1, 10, 10, 300, 40, 0, 30, #PB_TrackBar_Ticks)
     
Repeat
    Select WaitWindowEvent()
      Case #PB_Event_CloseWindow
        Quit = 1
       
      Case #PB_Event_Gadget
        Select EventGadget()
          Case 1           
            If i = 0
              state(0) = GetGadgetState(1)
            EndIf
            i+1           
            If i > 2
              i = 1
            EndIf
            state(i) = GetGadgetState(1)         
            If state(1) = state(2)
              i = 0
;               If state(0) < GetGadgetState(1)         
;                 state(0)-1
;               Else
;                 state(0)+1
;               EndIf
            EndIf
            Debug state(0)
            Debug GetGadgetState(1)
        EndSelect
    EndSelect
Until Quit = 1
EndIf

_________________
Egypt my love


Top
 Profile  
Reply with quote  
 Post subject: Re: Get start & end of TrackBar Readings
PostPosted: Mon Mar 30, 2020 7:57 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Nov 05, 2006 11:42 pm
Posts: 4844
Location: Lyon - France
Thanks for sharing 8)

_________________
ImageThe happiness is a road...
Not a destination


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: highend, Seymour Clufley and 15 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye