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: 546
  • src.zip
    12.7 KB · Views: 472
Last edited:

RaymondHung

Member
Licensed User
Longtime User
Hi Johan,

Do you know why forwarding your StartPointSeekBar.zip file with Gmail will be blocked due to security reasons?
 

RaymondHung

Member
Licensed User
Longtime User
Thanks DonManfred

But in my application using StartPointSeekBar, APK file using Gmail will be blocked for security reasons,
no problem if not used. I want to know what is the reason?
 

Johan Schoeman

Expert
Licensed User
Longtime User
It is to replace the old file with two new ones. It can be sent back to the original position, right?
You need to make sure that you keep the names of your png files the same as what they are at present.
 

Mr Blue Sky

Active Member
Licensed User
Longtime User
Hi Johan Schoeman
is it possible to have the decimal point with this library very interesting because the SeekBar displays units only

B4X:
Sub Globals
    Dim myval As Int
    Private StartPointSeekBar1 As StartPointSeekBar
    Private hpll As Label
    Private hplh As Label
    Private hpl As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("main")

    ' High Pressure alarm limit unit
    StartPointSeekBar1.TheBackgroundColor = Colors.DarkGray
    StartPointSeekBar1.TheRangeColor = 0xFF33B5E5
    StartPointSeekBar1.MinValue = 0                   
    StartPointSeekBar1.maxValue = 6.9
    StartPointSeekBar1.ThumbValue = 2.5
    '============================
    hpll.Text = 0
    hpll.TextColor = Colors.Red
    hpll.TextSize = 20
    hplh.Text = 6.9
    hplh.TextColor = Colors.Red
    hplh.TextSize = 20
    '============================
    hpl.Color = Colors.Transparent
    hpl.TextColor = Colors.White
    hpl.TextSize = 30
    hpl.Text = StartPointSeekBar1.CurrentThumbValue
End Sub

Sub StartPointSeekBar1_value_changed
    myval = StartPointSeekBar1.CurrentThumbValue
    hpl.Text = Round2(myval,2)
End Sub

Screenshot_2018-09-25-03-11-27.png
 

klaus

Expert
Licensed User
Longtime User
Set the returned value type to Double instead of Int.
And use Numberformat to display the value.

B4X:
Dim myval As Double


Sub StartPointSeekBar1_value_changed
    myval = StartPointSeekBar1.CurrentThumbValue
    hpl.Text = Numberformat(myval, 1, 2)
End Sub
 
Last edited:

Mr Blue Sky

Active Member
Licensed User
Longtime User
Decidedly what will I do without you and jordi must I stop working until hours not possible I have more eyes in front of the holes. many thank Klaus
 
Last edited:

HammerZeta

Member
Licensed User
Hi Johan Schoeman

I want to thank you for StartPointSeekBar. I am using it in a program that I am doing.
I've also been looking at your big list of contributions to the forum, thank you very much for your collaboration.

a cordial greeting
 
Top