B4A Class Input Slider Class

red30

Active Member
Licensed User
"Y" And how to change the axis. To the upper position and the maximum value was at minimum lower. For vertical slider ...
 

SandroB4A

Member
Licensed User
Hi all,

I like very much this Slider Class and I tried to do a change I need without success :(, I'd like to use a discrete value different than 1.

For example I want a slider with values from 0 to 20 every 5.

Someone can help me?

Thanks

EDIT: I realized it's an abovious question, I simply set the range from 0 to 4 and then multiply by 5 all the results...
 
Last edited:

stevel05

Expert
Licensed User
@SandroB4A Check InputSlider1-2.zip in the first post. I have added a Steps method, it should do what you want.

If you are using a different version, you should be able to copy the relevant code to that version.
 

Duncan H Williamson

Member
Licensed User
@SandroB4A Check InputSlider1-2.zip in the first post. I have added a Steps method, it should do what you want.

If you are using a different version, you should be able to copy the relevant code to that version.
Hi
This is a great slider !! I am having one small problem, I have set the maxval to 100 however when I slide the slider to the right the value shows as 577.
I need the slider to go from 0 to 100...
Regards

Duncan
 

Duncan H Williamson

Member
Licensed User
B4X:
InputSlider1.SetSliderColor(Colors.blue)
    InputSlider1.SetMaxVal(100)
    InputSlider1.SetValue(0)
    InputSlider1.SetDiscrete(True)
    InputSlider1.SetPointerCount(1)
this is in activity create
B4X:
Sub inputslider1_ValuesChanged(Values() As Float)
   Label1.Text = NumberFormat(Values(0), 1, 0)
End Sub
end this sub should display 0 to 100
Can you post your code
 

stevel05

Expert
Licensed User
OK, you are using DaveW's version. I think you need to set the number of pointers before anything else try changing your code to:

B4X:
    InputSlider1.SetPointerCount(1)
    InputSlider1.SetSliderColor(Colors.blue)
    InputSlider1.SetMaxVal(100)
    InputSlider1.SetValue(0)
    InputSlider1.SetDiscrete(True)
 

Duncan H Williamson

Member
Licensed User
OK, you are using DaveW's version. I think you need to set the number of pointers before anything else try changing your code to:

B4X:
    InputSlider1.SetPointerCount(1)
    InputSlider1.SetSliderColor(Colors.blue)
    InputSlider1.SetMaxVal(100)
    InputSlider1.SetValue(0)
    InputSlider1.SetDiscrete(True)
Thanks Steve, that has sorted the problem
Regards

Duncan
 
Top