Dynamic slider range

Dynamic slider range

Anonymous
Not applicable
443 Views
4 Replies
Message 1 of 5

Dynamic slider range

Anonymous
Not applicable
I want to by able to alter the range values of a slider dynamically. In this example the button is meant to cap the slider's range from 100 to 50, but it doesn't seem to work. Can someone tell me what I am doing wrong? Do I need to update the slider with the new range? Thank you.


rollout dynamicSlider "Dynamic Slider Test" width:150 height:150
(
local sldRange =
slider maxSlider "Slider" pos: width:120 height:44
label maxSliderLBL "" pos: width:120 height:22 range:sldRange
button btn1 "Button" pos: width:80 height:25

on maxSlider changed val do
(
maxSliderLBL.text = maxSlider.value as string
)

on btn1 pressed do
(
sldRange=
print sldRange
if maxSlider.value > 50 then maxSlider.value = 50
maxSliderLBL.text = maxSlider.value as string
)
)

createDialog dynamicSlider
0 Likes
444 Views
4 Replies
Replies (4)
Message 2 of 5

miauuuu
Collaborator
Collaborator
on btn1 pressed do
(
sldRange =
if maxSlider.value > 50 do
(
maxSlider.range = sldRange
maxSlider.value = 50
)
maxSliderLBL.text = maxSlider.value as string
)
https://miauu-maxscript.com/
0 Likes
Message 3 of 5

Anonymous
Not applicable
Thank you for the extremely quick reply! Whilst on the subject of sliders; is it possible to make a vertical slider with a height of more than 100?
0 Likes
Message 4 of 5

barigazy
Enthusiast
Enthusiast
Just use orient property for the slider. See this page
0 Likes
Message 5 of 5

miauuuu
Collaborator
Collaborator
The slider control do not have length and width property, so you can't create a slider with length = 50. The orientation can be changed - follow the link from the Branko.
But, actually, you can create sliders with custom length. Just follow this link and don't forget to give credit to Denis Trofimov
https://miauu-maxscript.com/
0 Likes