Sign in to follow this  
Followers 0

Sliders with input and StringFormat()

1 post in this topic

#1 ·  Posted (edited)

I got it to synch as you slide the slider, but I want it to always show x.xx, I dont really understand how im supposed to use StringFormat() with a func like GUICtrlRead()

#Include <GUIConstants.au3>
$Window = GUICreate("Test", 416, 131, 379, 294)
$Slider = GUICtrlCreateSlider(90, 40, 96, 21,$TBS_NOTICKS)
$Delay = GUICtrlCreateInput("2.00", 135, 75, 51, 21, $ES_READONLY, $WS_EX_CLIENTEDGE)

While 1
    $msg = GuiGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then Exit
        Case ControlGetFocus("Test") = "msctls_trackbar321"
            If GUICtrlRead($Slider) <> GUICtrlRead($Delay) Then GUICtrlSetData($Delay,StringFormat("%.2f",GUICtrlRead($Slider)/10))

Oh i got it, the helpfile was confusing I thought the variable you put as a string lol..

$S =StringFormat ( "$String = %s" & @CRLF & "$Float = %.2f" & @CRLF & "$Int = %d" ,$String, $Float, $Int )


now I feel pretty stupid :/ I fixed the code above

Edited by Rad

Share this post

Link to post
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
Sign in to follow this  
Followers 0