Jump to content
Sign in to follow this  
d0n

slider snap to 5,10,15?

Recommended Posts

d0n

is it possible to make a slider snap to certain numbers making it impossible to select other numbers?

like 5,10,15,20.... so on and you can't pick 6,7,8,14 ?

Share this post


Link to post
Share on other sites
Authenticity

#include <GUIConstantsEx.au3>
#include <SliderConstants.au3>

Dim $hGUI = GUICreate('Test', 200, 250)
Dim $Slider = GUICtrlCreateSlider(25, 20, 150, 35)
Dim $Static = GUICtrlCreateLabel('', 25, 60, 100, 23)

GUICtrlSetLimit($Slider, 5)
GUICtrlSendMsg($Slider, $TBM_SETLINESIZE, 0, 1)
GUICtrlSendMsg($Slider, $TBM_SETPAGESIZE, 0, 2)
GUICtrlSendMsg($Slider, $TBM_SETTICFREQ, 1, 0)
GUICtrlSetData($Static, '0')
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $Slider
            GUICtrlSetData($Static, String(GUICtrlRead($Slider)*20))
        Case -3
            ExitLoop
    EndSwitch
WEnd

GUIDelete()
Exit

Edited by Authenticity

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×