Jump to content

Slider


Recommended Posts

Hi,

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
Link to comment
Share on other sites

Maybe...

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

Example()

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
                ExitLoop

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

        EndSwitch
    WEnd

    ; Delete the previous GUI and all controls.
    GUIDelete($hGUI)
EndFunc   ;==>Example

8)

NEWHeader1.png

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...