Jump to content

Sliders with input and StringFormat()


Rad
 Share

Recommended Posts

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)
GUICtrlSetLimit($Slider,12*10,2*10)

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

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