Jump to content

slider events


 Share

Recommended Posts

Try this example:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $iSlider, $hSlider, $iDumSlider

Example()

Func Example()
    Local $button, $msg

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

    $iSlider = GUICtrlCreateSlider(10, 10, 200, 20)
    GUICtrlSetLimit(-1, 200, 0) ; change min/max value
    GUICtrlSetCursor(-1, 0)
    GUICtrlSetState(-1, $GUI_FOCUS)

    $hSlider = GUICtrlGetHandle($iSlider)
    $iDumSlider = GUICtrlCreateDummy()

    $button = GUICtrlCreateButton("Value?", 75, 70, 70, 20)

    GUISetState()
    GUIRegisterMsg($WM_HSCROLL, "_GUIEvents")

    GUICtrlSetData($iSlider, 45) ; set pos

    Do
        $msg = GUIGetMsg()

        If $msg = $button Then
            MsgBox(0, "iSlider", GUICtrlRead($iSlider), 2)
        EndIf
    Until $msg = $GUI_EVENT_CLOSE
EndFunc   ;==>Example

Func _GUIEvents($hWnd, $iMsgID, $WParam, $LParam)
    #forceref $hWnd, $iMsgID, $wParam, $lParam

    Switch $iMsgID
        Case $WM_HSCROLL
            Switch $LParam
                Case $hSlider
                    GUICtrlSendToDummy($iDumSlider, GUICtrlRead($iSlider))
            EndSwitch
    EndSwitch
EndFunc   ;==>_GUIEvents

Regards,

João Carlos.

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

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...