# Function Reference

# GUICtrlCreateSlider

Creates a Slider control for the GUI.

GUICtrlCreateSlider ( left, top [, width [, height [, style = -1 [, exStyle = -1]]]] )

## Parameters

left | The left side of the control. If -1 is used then left will be computed according to GUICoordMode.
top | The top of the control. If -1 is used then top will be computed according to GUICoordMode.
width | [optional] The width of the control (default is the previously used width).
height | [optional] The height of the control (default is the previously used height).
style | [optional] Defines the style of the control. See GUI Control Styles Appendix. default (-1) : $TBS_AUTOTICKS
exStyle | [optional] Defines the extended style of the control. See Extended Style Table.

## Return Value

Success: | the identifier (controlID) of the new control.
Failure: | 0.

## Remarks

To obtain the value of the control see GUICtrlRead().
To set or change information in the control see GUICtrlUpdate...() functions.
To update the bar position just use GUICtrlSetData().
To set the min and max value use GUICtrlSetLimit().
To combine styles with the default style use BitOR($GUI_SS_DEFAULT_SLIDER, newstyle, ... ).
To use the values specified above you must #include <SliderConstants.au3> in your script.
Default resizing is $GUI_DOCKAUTO size and position will occur.

## Related

GUICoordMode (Option), GUICtrlSetData, GUICtrlSetLimit, GUICtrlUpdate..., GUIGetMsg

## Example

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

    Example()

    Func Example()

        GUICreate("slider", 220, 100, 100, 200)
        GUISetBkColor(0x00E0FFFF) ; will change background color

        Local $idSlider1 = GUICtrlCreateSlider(10, 10, 200, 20)
        GUICtrlSetLimit(-1, 200, 0) ; change min/max value
        Local $idButton = GUICtrlCreateButton("Value?", 75, 70, 70, 20)
        GUISetState(@SW_SHOW)
        GUICtrlSetData($idSlider1, 45) ; set cursor

        Local $idMsg
        ; Loop until the user exits.
        Do
            $idMsg = GUIGetMsg()

            If $idMsg = $idButton Then
                MsgBox($MB_SYSTEMMODAL, "slider1", GUICtrlRead($idSlider1), 2)
            EndIf
        Until $idMsg = $GUI_EVENT_CLOSE
    EndFunc   ;==>Example