Jump to content

Recommended Posts

Posted

Can the direction of vertical sliders be reversed so that its value is lower at the bottom and larger at the top? Try this sample script to see how it currently behaves.

#include <GuiConstantsEx.au3>
#include <SliderConstants.au3>

GUICreate("Sample GUI", 200, 170)

; SLIDER (vertical)
$iValue2 = 25
$iVSlideValue = GUICtrlCreateLabel($iValue2, 35, 30, 35, 15)
$iSlider2 = GUICtrlCreateSlider(20, 45, 40, 100, BitOR($TBS_AUTOTICKS, $TBS_BOTH, $TBS_VERT))
GUICtrlSetData(-1, $iValue2)
GUICtrlSetLimit($iSlider2, 50, 10)

GUICtrlCreateLabel("Can the diredtion of" & @LF & _
        "vertical sliders be" & @LF & _
        "be reversed so that " & @LF & _
        "sliding down returns" & @LF & _
        "the lower value and" & @LF & _
        "up the larger value?" & @LF & _
        @LF & _
        "  ( try this slider )", _
        85, 30, 100, 120)

GUISetState()
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then
        ExitLoop
    ElseIf $msg = $iSlider2 Then
        GUICtrlSetData($iVSlideValue, GUICtrlRead($iSlider2))
    EndIf
WEnd

Exit

ILLBeBack

Posted (edited)

Hi, I use simple maths to convert the value.

#include <GuiConstantsEx.au3>
#include <SliderConstants.au3>

GUICreate("Sample GUI", 200, 170)

; SLIDER (vertical)
$iMax = 50
$iMin = 10
$iValue2 = $iMax/2
$iVSlideValue = GUICtrlCreateLabel($iValue2, 35, 30, 35, 15)
$iSlider2 = GUICtrlCreateSlider(20, 45, 40, 100, BitOR($TBS_AUTOTICKS, $TBS_BOTH, $TBS_VERT))
GUICtrlSetData(-1, $iValue2)
GUICtrlSetLimit($iSlider2, $iMax, $iMin)

GUICtrlCreateLabel("Can the diredtion of" & @LF & _
        "vertical sliders be" & @LF & _
        "be reversed so that " & @LF & _
        "sliding down returns" & @LF & _
        "the lower value and" & @LF & _
        "up the larger value?" & @LF & _
        @LF & _
        "  ( try this slider )", _
        85, 30, 100, 120)

GUISetState()
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then
        ExitLoop
    ElseIf $msg = $iSlider2 Then
        GUICtrlSetData($iVSlideValue, $iMax - GUICtrlRead($iSlider2) + $iMin)
    EndIf
WEnd

Exit

Edited by smashly
Posted

Hi, I use simple maths to convert the value.

Thanks smashly, I truly appreciate the trouble you went through to reply and to provide a working example. I've done that in the past, but was hoping I had overlooked a setting. It would be nice if GUICtrlSetLimit would work in reverse, but it doesn't.

ILLBeBack

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
×
×
  • Create New...