B4A Class clsSlideBar for B4A/B4i

Discussion in 'Additional libraries, classes and official updates' started by Hugh Thomas, Jul 24, 2016.

  1. Hugh Thomas

    Hugh Thomas Member Licensed User

    This is another in a series of classes I've written to simplify B4A/B4i cross-platform development.

    This class implements a "SlideBar" which is a cross between a B4A SeekBar and a B4i Slider. It presents the same interface on B4A and B4i, and in fact the class code is the same on B4A and B4i. i.e., you can select all of the class code in B4i and cut and paste it into a B4A class module (and vice versa).

    It is implemented as a Custom View so can be set up either in the Designer or programmatically. Examples of both are included in the attached sample project.

    You can set up the range of the SlideBar in two ways:

    1. a float range from a "min" to a "max" value. Both the minimum and/or maximum values can be negative as long as min is less than max. You can also specify the precision, i.e. how many decimal places are to be displayed. Setting the precision to 0 effectively gives you an integer range.
    2. with a list of values. For example, you can provide a list containing strings, eg "XXS","XS", "S","M","L","XL","XXL". By default this would create a SlideBar with an index ranging from 0 to 6, but you can optionally specific a base index. So in this example you can set the base index to -3, so "XXS" would be index -3, "XS" is -2, up to "XXL" as +3".
    There are a number of formatting options available.
    • The SlideBar can be aligned either horizontally or vertically.
    • You can draw a scale beside the SlideBar. There are a number formatting options to control where the scale is located in relation to the SlideBar, it's orientation, color, size, etc. If the SlideBar range was set with a list, then the list values will be displayed on the scale, not the index values.
    • You can add a heading
    See the attached screenshots for examples.

    I've used SlideBars in my GroupCalc app, which is available in the Google Play Store and the iTunes App Store.

    Any feedback welcome.

    Hugh
     

    Attached Files:

    paragkini, javiers, DavideV and 7 others like this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice