B4A Class Input Slider Class

I'm not quite sure where to post this, but while testing the beta, I came up with an input slider class that allows simple use of images to create interesting sliders similar to the seek bars we are used to.

I thought it may be useful to share as it's using a few of the new functions (all without problems I should say). And obviously you can tailor it to your needs.

If you get a chance to have a look, let me know how it works for you.

V1.00 attached

Steve

@Erel. perhaps we should have a new section in the forum for shared classes/code modules as I think these will far outnumber libraries in the future.

19/6/2012 - V1.01 attached
07/02/2014 V1.02 - Added released callback, called when the slider is released.
07/02/2014 Added InputSlider CustomView V1.00 (iscv.zip) see post #7
15/02/2015 Added InputSlider CV1-1 minor updates required for MidiSystem, Download and compile to library.
NOTE: This will break existing code as it uses get/setters for most variables, so if you have an existing app, use the old version. If you have compiled it to a library, give this one a different name before compiling.

3/4/2017 - InputSlider1-2 : Added a Steps options to allow discrete value changes. see post #22
 

Attachments

  • is.zip
    12 KB · Views: 796
  • is1-02.zip
    12.2 KB · Views: 486
  • iscv.zip
    14.1 KB · Views: 517
  • inputslidercv1-2.zip
    15.3 KB · Views: 393
Last edited:

red30

Well-Known Member
Licensed User
Longtime 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
Longtime 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
Longtime 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
Longtime 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
Longtime 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
Longtime 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
Longtime 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