It is currently Thu Dec 13, 2018 2:37 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Special TrackBar Gadget [Windows]
PostPosted: Thu Oct 11, 2018 2:52 am 
Offline
Addict
Addict

Joined: Sun Apr 12, 2009 6:27 am
Posts: 3146
The title said it all
Code:
  #TBS_TOOLTIPS = $100
 
  If OpenWindow(0, 0, 0, 320, 450, "TrackBarGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    TextGadget    (3, 10,  20, 250, 20,"TrackBar Standard", #PB_Text_Center)
    TrackBarGadget(0, 10,  40, 300,50, 0, 24,#PB_TrackBar_Ticks|#TBS_TOOLTIPS |#TBS_FIXEDLENGTH )
    SetGadgetState(0, 12)
    SendMessage_(GadgetID(0), #TBM_SETTHUMBLENGTH,25,0)
    SendMessage_(GadgetID(0), #TBM_SETPAGESIZE ,0,1)
    ticn0 = SendMessage_(GadgetID(0), #TBM_GETRANGEMAX ,0,0)
    SendMessage_(GadgetID(0), #TBM_GETCHANNELRECT,0,r.RECT)
    ts0 = (r\right - r\left)/ticn0
   
    TrackBarGadget(1, 10,  100, 50,300, 0, 30,#PB_TrackBar_Ticks|#TBS_TOOLTIPS |#TBS_FIXEDLENGTH | #PB_TrackBar_Vertical|199726)
    SetGadgetState(1, 15)
    SendMessage_(GadgetID(1), #TBM_SETTHUMBLENGTH,25,0)
    SendMessage_(GadgetID(1), #TBM_SETPAGESIZE ,0,1)
    ticn1 = SendMessage_(GadgetID(1), #TBM_GETRANGEMAX ,0,0)
    SendMessage_(GadgetID(1), #TBM_GETCHANNELRECT,0,r.RECT)
    ts1 = (r\right - r\left)/ticn1
   
 Repeat
    Select WaitWindowEvent()
     
      Case #PB_Event_CloseWindow
        Quit = 1       
       
      Case #PB_Event_Gadget
        Select EventGadget()
          Case 0
            If  GetAsyncKeyState_(#VK_LBUTTON)
               GetCursorPos_ (@p.POINT)
               ScreenToClient_ (GadgetID(0), @p)
               SetGadgetState(0, (p\x-ts0)/ts0)
            EndIf
           
          Case 1
            If  GetAsyncKeyState_(#VK_LBUTTON)
              GetCursorPos_ (@p.POINT)
              ScreenToClient_ (GadgetID(1), @p)
              SetGadgetState(1, (GadgetHeight(1)-p\y-ts1 )/ts1)
            EndIf
        EndSelect
       
             

  EndSelect   
 Until Quit = 1
  EndIf


_________________
Egypt my love


Top
 Profile  
Reply with quote  
 Post subject: Re: Special TrackBar Gadget [Windows]
PostPosted: Thu Oct 11, 2018 12:10 pm 
Offline
Addict
Addict

Joined: Mon Feb 16, 2015 2:49 pm
Posts: 1658
Nice code, thanks! :)


Top
 Profile  
Reply with quote  
 Post subject: Re: Special TrackBar Gadget [Windows]
PostPosted: Thu Oct 11, 2018 2:27 pm 
Offline
Enthusiast
Enthusiast

Joined: Fri Apr 25, 2003 11:08 pm
Posts: 432
Rashad,

I like it!

Can you tell me what the magic number 199726 represents?
It doesn't seem to be any combination of the #TBS_ trackbar values.

Regards,
Eric


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

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 14 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