Function Reference


_GUICtrlSlider_GetTicPos

Retrieves the current physical position of a tick mark

#include <GuiSlider.au3>
_GUICtrlSlider_GetTicPos ( $hWnd, $iTic )

Parameters

$hWnd Control ID/Handle to the control
$iTic 0-based index identifying a tick mark. The positions of the first and last tick marks are not directly available via this message.

Return Value

Success: The following values for type of slider:
        horizontal - The x-coordinate of the tick mark
        vertical - The y-coordinate of the tick mark
Failure: -1.

Remarks

Because the first and last tick marks are not available through this function, valid indexes are offset from their tick position on the slider.
If the difference between _GUICtrlSlider_GetRangeMin() and _GUICtrlSlider_GetRangeMax() is less than two, then there is no valid index and this message will fail.

Example

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

Example()

Func Example()
        Local $iTic = Random(1, 99, 1), $idSlider

        ; Create GUI
        GUICreate("Slider Get Tic Pos", 400, 296)
        $idSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
        GUISetState(@SW_SHOW)

        ; Get Tic Pos
        MsgBox($MB_SYSTEMMODAL, "Information", StringFormat("Tic %d: X Pos: %d", $iTic, _GUICtrlSlider_GetTicPos($idSlider, $iTic)))

        ; Loop until the user exits.
        Do
        Until GUIGetMsg() = $GUI_EVENT_CLOSE
        GUIDelete()
EndFunc   ;==>Example