Jump to content

Slider returning strange values!


DigiBox
 Share

Recommended Posts

Hello!

Please help me with this small problem I've encountered while learning to make GUI.

I'm not able to get the set slider values out of sliders and I can't figure out why.
The slider value in the example is preset to 1, but whatever I set the slider to, it returns the value 3 when I click Apply and I havn't set any value to 3.

Where is that 3 coming from?
 

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

Global $LRSlider

Opt("GUIOnEventMode", 1)

Global $Form1 = GUICreate("test slider", 200, 200, -1, -1)
Global $LRSlider = GUICtrlCreateSlider(50, 50, 100, 20, $TBS_TOOLTIPS)
GUICtrlSetLimit($LRSlider, 50, 1)
GUICtrlSetData($LRSlider, 1)
GUISetOnEvent($GUI_EVENT_CLOSE, "Exit1")

Global $ApplyButton = GUICtrlCreateButton("APPLY", 100, 150, 89, 17)
GUICtrlSetOnEvent($ApplyButton, "Apply")

GUISetState(@SW_SHOW)

Func Apply()
    GUICtrlRead($LRSlider)
    MsgBox(0, 0, $LRSlider)
    GUICtrlSetData($LRSlider, $LRSlider)
EndFunc   ;==>Apply

Func Exit1()
    Exit
EndFunc   ;==>Exit1

While 1
    Sleep(200)
WEnd

 

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

×
×
  • Create New...