Jump to content
Sign in to follow this  


Recommended Posts


I am pretty new to Autoit and currently creating a GUI that contains some sliders. Very thankful for any hint!

1) Is it possible to label the ticks of a slider other than creating separate labels, that I position myself? Please see the code below - certainly there is a more elegant solution?

2) Lets say the slider shall range from 1 to 9, and I want only uneven numbers to be selectable. How do I do that?


This is how I solved it so far: I had to disable tooltips cause they contradict my lablels:

GUICtrlCreateLabel("Kernel", 25, 253)
    local $iKernel_size = GUICtrlCreateSlider (175, 250, 200,20)
    GUICtrlSetLimit ($iKernel_size,5,1)

    GUICtrlCreateLabel("1", 181, 273)
    GUICtrlCreateLabel("5", 271, 273)
    GUICtrlCreateLabel("9",361, 273)

... and did calculate afterwards the actual value:

$iKernel_size  = GUICtrlRead($iKernel_size)
$iKernel_size = ($iKernel_size * 2) -1

Thank you very much for helping!

Edited by dejhost

Share this post

Link to post
Share on other sites


#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>


Func Example()
    ; Create a GUI with various controls.
    Local $hGUI = GUICreate("Example", 300, 200)

    ; Create a combobox control.
    Local $idComboBox = GUICtrlCreateCombo("Item 1", 10, 10, 185, 20)
    Local $idClose = GUICtrlCreateButton("Close", 210, 170, 85, 25)

    ; Add additional items to the combobox.
    GUICtrlSetData($idComboBox, "Item 3|Item 5|Item 7", "Item 1")

    ; Display the GUI.
    GUISetState(@SW_SHOW, $hGUI)

    Local $sComboRead = ""

    ; Loop until the user exits.
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE, $idClose

            Case $idComboBox
                $sComboRead = GUICtrlRead($idComboBox)
                MsgBox($MB_SYSTEMMODAL, "", "The combobox is currently displaying: " & $sComboRead, 0, $hGUI)


    ; Delete the previous GUI and all controls.
EndFunc   ;==>Example


Share this post

Link to post
Share on other sites

Hi Valuater,

Thanks for your post!

I appreciate the idea, but this is only one of many sliders I need. For most of them, a combobox is not applicable.


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  

  • Create New...