# Function Reference

GUICtrlCreateSlider

Creates a Slider control for the GUI.

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

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: | Returns the identifier (controlID) of the new control.
Failure: | Returns 0.

Remarks

To obtain the value of the control see GUICtrlRead.
To set or change information in the control see GUICtrlSet....
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,...).
Default resizing is $GUI_DOCKAUTO size and position will occur.

Related

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

Example

#include <GUIConstants.au3>
GUICreate("slider",220,100, 100,200)
GUISetBkColor (0x00E0FFFF) ; will change background color
$slider1 = GUICtrlCreateSlider (10,10,200,20)
GUICtrlSetLimit(-1,200,0) ; change min/max value
$button = GUICtrlCreateButton ("Value?",75,70,70,20)
GUISetState()
GUICtrlSetData($slider1,45) ; set cursor
$start=TimerInit()
Do
$n = GUIGetMsg ()
If $n = $button Then
MsgBox(0,"slider1",GUICtrlRead($slider1),2)
$start=TimerInit()
EndIf
Until $n = $GUI_EVENT_CLOSE