B4i Library iRangeBar Library

Hello everyone, i am please to post my first B4i wrapped library, i am working on a project for a customer and I had the need to use a RangeBar view, after trying to create one with B4X and not getting the results i wanted I decided to search online for something that could be wrapped easily, after a lot of searching around I came across the following library, it didn't take very long to wrap it, please take a look and let me know if you guys see any issues.

All the images used can be custom made and set them in the library.
image0 (1).png


iRangeBar
Version:
1
  • iRangeBar
    Events:
    • SliderValueChanged (leftValue As Double, rightValue As Double)
    • Click
    • LongClick
  • Methods:
    • IsInitialized As BOOL
      Tests whether this object was initialized.
    • CalcRelativeKeyboardHeight: (KeyboardHeight As double) As double
      Calculates the keyboard top point relative to the current view.
    • SetColorAnimated:: (DurationMS As int, BackgroundColor As int) As void
      Animates the view's background color.
      DurationMS - Animation duration measured in milliseconds.
      BackgroundColor - The new background color.
      Note that Labels do not support this type of animation.
    • SetAlphaAnimated:: (DurationMS As int, Alpha As float) As void
      Animates the view's alpha level.
      DurationMS - Animation duration measured in milliseconds.
      Alpha - The new alpha level (0 - transparent, 1 - fully opaque).
    • SetLayoutAnimated:::::: (DurationMS As int, DampingRatio As float, Left As float, Top As float, Width As float, Height As float) As void
      Animates the view's layout.
      DurationMS - Animation duration measured in milliseconds. Set to 0 to change the layout immediately.
      DampingRatio - If smaller than 1 then a spring effect will be applied to the animation. The minimum value should be 0.1.
      Set to 1 for no spring effect.
      Left, Top, Width and Height - The new layout.
    • SetBorder::: (Width As float, Color As int, CornerRadius As float) As void
      Sets the view's border width, color and corner radius.
      Note that the corner radius should be 0 if the view should show a shadow as well.
    • SetShadow::::: (Color As int, OffsetX As float, OffsetY As float, Opacity As float, StaticRect As BOOL) As void
      Adds a shadow to to the view. The border corners radius should be set to 0 when adding shadows.
      Colors - The shadow color.
      OffsetX, OffsetY - The horizontal and vertical offsets.
      Opacity - Sets the shadow opacity: 0 - transparent, 1 - opaque.
      StaticRect - (optimization parameter) Set this parameter to True if the view's size is constant.
    • SizeToFit As void
      Resizes the view to make it fit its content.
    • RequestFocus As BOOL
      Tries to set the focus on the current view. Returns True if the focus was set. Most views are not focusable.
      When a text view is focused the keyboard is shown.
    • ResignFocus As BOOL
      Removes the focus from the current view. Removing the focus from a text view will hide the keyboard.
    • RemoveViewFromParent As void
      Removes the view from its parent (same as B4A View.RemoveView method).
    • BringToFront As void
      Brings the view to front.
    • SendToBack As void
      Sends the view to the back.
    • SetParallaxEffect:: (Vertical As int, Horizontal As int) As void
      Adds a parallax effect to the view. The view will slightly move when the device is tilted.
      Vertical - Vertical offset. Can be a positive or negative value.
      Horizontal - Horizontal offset. Can be a positive or negative value.
    • DesignerCreateView::: (base As B4IPanelWrapper*, lw As B4ILabelWrapper*, props As B4IMap*) As void
    • setMinValue:: (minValue As double, maxValue As double) As void
      Sets the Minimum and Maximum Value
    • setLeftValue:: (leftValue As double, rightValue As double) As void
      Sets the Left and Right Values
    • setMinimumDistance: (minimumDistance As double) As void
      Sets the Minimum Distance between left and right value
    • assigntrackImage: (trackimage As UIImage*) As void
      Sets the background Image for the RangeBar
    • assignrangeImage: (rangeimage As UIImage*) As void
      Sets the Range Image
    • assignleftThumb: (thumbimage As UIImage*) As void
      Sets the Left Thumb image
    • assignrightThumb: (thumbimage As UIImage*) As void
      Seets the Right Thumb image
  • Properties:
    • Tag As NSObject*
      Gets or sets the Tag object. This is a placeholder for any object you like to tie to this object.
    • Left As float
      Gets or sets the view's left position.
    • Top As float
      Gets or sets the view's top position.
    • Width As float
      Gets or sets the view's width.
    • Height As float
      Gets or sets the view's height.
    • Color As int
      Gets or sets the view's background color.
    • Alpha As float
      Gets or sets the view's alpha level. 0 - transparent, 1 (default) - fully opaque.
    • TintColor As int
      Gets or sets the view's tint color. Some views use this color to change their appearance.
    • Visible As BOOL
      Gets or sets whether the view is visible.
    • IsFocused As BOOL [read only]
      Returns true if the view is focused.
    • UserInteractionEnabled As BOOL
      Gets or sets whether the user can interact with this view. True by default.
    • Parent As B4IViewWrapper* [read only]
      Returns the views parent. The returned view can be uninitialized (if there is no parent).
    • BaseView As B4IViewWrapper* [read only]
    • Text As NSString*
    • minimumValue As double [read only]
    • maximumValue As double [read only]
    • leftValue As double [read only]
    • rightValue As double [read only]
    • leftThumbView As UIView* [read only]
    • rightThumbView As UIView* [read only]
    • pushable As BOOL
      @property (nonatomic, assign) float minimumDistance;
    • disableOverlapping As BOOL
    • sendInstantUpdates As BOOL
    • trackImage As UIImage*
      Images
    • rangeImage As UIImage*
    • leftThumbImage As UIImage*
    • rightThumbImage As UIImage*

Updated Library Zip folder and included the xml file 1/6/2021
 

Attachments

  • iRangeBarExample.zip
    27.4 KB · Views: 10
  • iRangeBar_v1.0.zip
    56.2 KB · Views: 6
Last edited:

Sandman

Expert
Licensed User
Longtime User
This is not critique but genuine curiosity:

Are there any real upsides to wrapping a library such as this one instead of just remaking it in native B4X code? (To me it seems more complicated to wrap than to remake.)
 

walterf25

Expert
Licensed User
Longtime User
This is not critique but genuine curiosity:

Are there any real upsides to wrapping a library such as this one instead of just remaking it in native B4X code? (To me it seems more complicated to wrap than to remake.)
I tried making it in B4X but was not successful, I'm not too familiar with making cross framework libs, and to be honest wrapping this took me no more than 1 hour.

Walter
 

Sandman

Expert
Licensed User
Longtime User
I'm not too familiar with making cross framework libs
Understood, but for your usecase you probably could have made it a custom view just for B4i?

wrapping this took me no more than 1 hour
Very cool. In that case perhaps you would want to post a tutorial on your steps and reasoning? I don't think I've seen a tutorial on how to wrap things for B4i, and I'm guessing there are a lot of people interested in it.
 

walterf25

Expert
Licensed User
Longtime User
Very cool. In that case perhaps you would want to post a tutorial on your steps and reasoning? I don't think I've seen a tutorial on how to wrap things for B4i, and I'm guessing there are a lot of people interested in it.

I'm not sure i would be able to do that, I mean, I am able to understand the process but do not want to give wrong information to other users on how to wrap a b4i Library, honestly I just went with my own knowledge, and the way I perceive and understand things may not be the same as everyone else, but if you need help in setting up your own environment to try to create a small library for yourself, i can definitely help you with that.

I have spent a lot of time studying the libraries which Erel has made public, such as the iAdmob library, the SwiftButton Library and a few more, after I understood most of the concepts in those libraries I decided to give it a try and wrap this small RangeBar Library, in all honestly after you understand the basic concept it becomes fairly easy, you of course have to be familiar with Objective C.

Walter
 

MitchBu

Well-Known Member
Licensed User
Longtime User
Hello everyone, i am please to post my first B4i wrapped library, i am working on a project for a customer and I had the need to use a RangeBar view, after trying to create one with B4X and not getting the results i wanted I decided to search online for something that could be wrapped easily, after a lot of searching around I came across the following library, it didn't take very long to wrap it, please take a look and let me know if you guys see any issues.

All the images used can be custom made and set them in the library.

Sorry to rain on your parade, walterf25,but it does not work here.

I placed iRangeBar.h and libiRangeBar.a in the additionallibraries folder, but B4i does not recognize the library. Refresh does not show iRangeBar.

A quick look at the Internal libraries folder does not show any .h and .a files. Could it be the issue ?
 

walterf25

Expert
Licensed User
Longtime User
That is the thing. There is no xml file in the archive. :(
Sorry, I will upload today, but you can also have the xml file generated yourself.

Walter
 

walterf25

Expert
Licensed User
Longtime User
That is the thing. There is no xml file in the archive. :(
Done, uploaded the Library zip folder again and this time I've included the xml file, sorry about that.

Walter
 
Top