Jump to content
Sign in to follow this  

slider snap to 5,10,15?

Recommended Posts


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

#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')

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


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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.