B4A Library StartPointSeekBar

It wraps this Github project. Library files are in the /files folder of the attached B4A project. Copy them to your additional library folder. Java source code is in attached src.zip. A value_changed event is raised in B4A when you adjust/slide the seekbar. The actual/present value of the seekbar can then be obtained with a call to a library method (eg myval = spsb3.CurrentThumbValue). The range can be set from 0 to whatever value or from a negative minimum value to a positive maximum value.

1.png


...and when you touch the slider...

2.png


The library as it stands at present:

startpointseekbar
Author:
Johan Schoeman
Version: 1
  • StartPointSeekBar
    Fields:
    • ba As BA
    Methods:
    • BringToFront
    • DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
    • Initialize (EventName As String)
    • Invalidate
    • Invalidate2 (arg0 As Rect)
    • Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • IsInitialized As Boolean
    • RemoveView
    • RequestFocus As Boolean
    • SendToBack
    • SetBackgroundImage (arg0 As Bitmap)
    • SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
    • SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
    • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
    Properties:
    • Background As Drawable
    • Color As Int [write only]
    • CurrentThumbValue As Double [read only]
    • Enabled As Boolean
    • Height As Int
    • Left As Int
    • MinValue As Double [write only]
    • Tag As Object
    • TheBackgroundColor As Int [write only]
    • TheRangeColor As Int [write only]
    • ThumbValue As Double [write only]
    • Top As Int
    • Visible As Boolean
    • Width As Int
    • maxValue As Double [write only]
 

Attachments

  • StartPointSeekBar.zip
    22.9 KB · Views: 556
  • src.zip
    12.7 KB · Views: 481
Last edited:

Johan Schoeman

Expert
Licensed User
Longtime User

Johan Schoeman

Expert
Licensed User
Longtime User
While that is useful, many users might not know about your thread but the Library Updates thread is more popular. So it will be a good idea to post the updates there as well. @DonManfred updates on both threads.
See post #5.....:)
 

PABLO2013

Well-Known Member
Licensed User
Longtime User
regards
I wonder what could be causing the error, I want to use StartPointSeekBar in CheckList demo, tks

........................................................
Sub CreateItem(h, i As Int) As Panel
Dim pnl As Panel, lbl As Label, chk As CheckBox, edt As EditText,sb As StartPointSeekBar
pnl.Initialize("")

...

sb.Initialize("sb") 'View #1
sb.TheBackgroundColor = Colors.DarkGray
sb.TheRangeColor = 0xFF33B5E5
sb.MinValue = 0
sb.maxValue = 120
sb.ThumbValue = 60
...
End Sub
........................................................
 

Attachments

  • error.PNG
    error.PNG
    42.9 KB · Views: 277

Johan Schoeman

Expert
Licensed User
Longtime User
regards
I wonder what could be causing the error, I want to use StartPointSeekBar in CheckList demo, tks

........................................................
Sub CreateItem(h, i As Int) As Panel
Dim pnl As Panel, lbl As Label, chk As CheckBox, edt As EditText,sb As StartPointSeekBar
pnl.Initialize("")

...

sb.Initialize("sb") 'View #1
sb.TheBackgroundColor = Colors.DarkGray
sb.TheRangeColor = 0xFF33B5E5
sb.MinValue = 0
sb.maxValue = 120
sb.ThumbValue = 60
...
End Sub
........................................................
Seems to me as if you are missing some files in the /Objects/res/xxx folder(s) of your B4A project. Look inside the folders of the original project and make sure they are in the folders of your new project. Also make sure they are set to READ ONLY.
 

PABLO2013

Well-Known Member
Licensed User
Longtime User
regards I would like to know how you configure this to have a scale without zero,
for example: -5 -4 -3 -2 (1) 2 3 4 5
center=1

i put it , but the center is =0
sb.MinValue = -5
sb.maxValue = 5
sb.ThumbValue = 1
tks
 
Last edited:

Johan Schoeman

Expert
Licensed User
Longtime User
regards I would like to know how you configure this to have a scale without zero,
for example: -5 -4 -3 -2 (1) 2 3 4 5
center=1

i put it , but the center is =0
sb.MinValue = -5
sb.maxValue = 5
sb.ThumbValue = 1
tks
The library does not make provision for adding discrete points. It only works with a range. If you minimum value is a negative value and your maximum value is a positive value then zero will form part of the range.
 

PABLO2013

Well-Known Member
Licensed User
Longtime User
Thank you, could mask values...

myval = spsb1.CurrentThumbValue

ej: if myval=0 the myval=1 .......
 

Johan Schoeman

Expert
Licensed User
Longtime User
Thank you, could mask values...

myval = spsb1.CurrentThumbValue

ej: if myval=0 the myval=1 .......
I have seen a different project that I will wrap that should allow you to do what it is that you require. Give me time until this weekend to sort it out. But it will be 100% discrete values. Nothing inbetween.
 

PABLO2013

Well-Known Member
Licensed User
Longtime User
greetings ,
Have problems with the library in CheckList , and fellow put me :
https://www.b4x.com/android/forum/threads/class-checklist.18853/page-6#post-410254
"A view is expected by the function but the sender object is not. Please see this problem with the library author because I have no idea of what is a "StartPointSeekBar"."


It would be much trouble to add another button control
.........value1 ............value2
----------o----------------o------------ StartPointSeekBar


Thank you
 

Johan Schoeman

Expert
Licensed User
Longtime User
greetings ,
Have problems with the library in CheckList , and fellow put me :
https://www.b4x.com/android/forum/threads/class-checklist.18853/page-6#post-410254
"A view is expected by the function but the sender object is not. Please see this problem with the library author because I have no idea of what is a "StartPointSeekBar"."


It would be much trouble to add another button control
.........value1 ............value2
----------o----------------o------------ StartPointSeekBar


Thank you
Not sure what the solution is here as far as the "CheckList" is concerned. Have never used CheckList.

It would be much trouble to add another button control
The original project that I have wrapped does not make provision for this.
 

RaymondHung

Member
Licensed User
Longtime User
Hi Johan,

I want to know how can I change the outlook of the 2 files - seek_thumb_normal.png and seek_thumb_pressed.png

Thanks
 

Johan Schoeman

Expert
Licensed User
Longtime User
Hi Johan,

I want to know how can I change the outlook of the 2 files - seek_thumb_normal.png and seek_thumb_pressed.png

Thanks
You will have to edit them with something like GIMP. The code does not make provision for changing them programmatically.
 
Top