I'm trying to familiarize myself with sliders. Unfortunately the documentation isn't clear to me, and I haven't been able to find any video tutorial.
Here's my attempt :
- Have 3 vertical sliders, positioned evenly on a GUI, and centered vs. the GUI's width
- Display each slider's name at the bottom of every one
- Control the 3 sliders with 6 hotkeys : hotkey1 = slider 1 up, hotkey2 = slider 1 down, and so on.
- Every time a slider is modified, grab the corresponding lvl := %A_GuiControl% and display the slider's name and lvl value in a tooltip, also centered vs. the GUI's width
So I've tried to adapt it to my own needs :
Code: Select all
win = Multi-Slider Window
Fader1 := "NAME 1"
Fader2 := "NAME 2"
Fader3 := "NAME 3"
Gui, Color, 666666
Gui, Add, Slider, x40 y25 h100 w25 TickInterval3 Line3 Vertical Invert AltSubmit Range-6-6 vSlider1 ggo, 0
Gui, Add, Slider, % "x" 140 " y25 h100 w25 Vertical Invert AltSubmit Range-6-6 vSlider" 2 " ggo", 0
Gui, Add, Slider, % "x" 240 " y25 h100 w25 Vertical Invert AltSubmit Range-6-6 vSlider" 3 " ggo", 0
Gui, Add, Text, , %Fader1% %Fader2% %Fader3%
Gui, Show, w300 h150, Multi-Slider Test
Return
go: ; Subroutine for all sliders.
Gui, Submit, NoHide
lvl := %A_GuiControl% ; This needs to be the output from whichever slider is being used
setlevel(A_GuiControl,win,lvl)
Return
setlevel(control,window,level)
{
ToolTip, % control " : " level " dB", 100, 28
; slider = Slider20WndClass%control%
; SendMessage, 0x405, 1, %level%, %slider%, %window%,
; ControlSend, %slider%, {Right 1}, %window%
}
GuiClose:
ExitApp
There are some things that I don't understand. For example in this syntax : Gui, Add, Slider, % "x" 140 " y25 h100 w25 Vertical Invert AltSubmit Range-6-6 vSlider" 2 " ggo", 0
- The w25 seems to make no difference (I've tried w50 but the slider stays the same)
- Same thing for the AltSubmit. I've read that "it tells the program to use Microsoft's GDIPlus.dll to load the image, which might result in a different appearance for GIF, BMP, and icon images", but it makes no difference at all in this case.
- I don't understand the end part : vSlider" 2" ggo", 0
- The 3 sliders aren't automatically centered vs. the GUI width (I've only done it manually with hardcoded x values)
- I haven't been able to display each slider's name at the bottom of every one. I have tried the Buddy2 slider option with my defined variables (Fader1 to Fader3) but I haven't been able to make it work.
- The tooltip isn't automatically centered either (which is a problem since the tooltip's width will depend on the slider's name (which I haven't been able to display either)
- I haven't implemented the hotkeys yet (haven't figured out how to assign a hotkey to a specific slider).