B4A Library UISegmentedControl

UISegTop.jpg

This library was made based on UISegmentedControl for IOS

UISegmentedControl2.jpg


Installation instructions:
- Copy the .xml and .jar files to your custom libraries folder
- Select in your REFERENCED LIBRARIES
UISeg1.png



Version history:
V1.0 (Not published):
- Initial version

V1.1 (Not published):
- Bugs Corrections and add some features, like size of fonts, shadow (on/off), color of split, size of split, etc

V1.2 (First public release)

UISeg2.png


UISegmented
Author:
Alberto Iglesias
Version: 1.2
  • UISegmented
    Fields:
    • _shadow As Boolean
    • _splitcolor As Int
    • _splitwidth As Int
    Methods:
    • IsInitialized As Boolean
      Tests whether the object has been initialized.
    • _addbutton (pID As String, pText As String, pColor As Int, pSize As Int) As String
      Add a button like Segment.
      pID = Identifier to your Segment Button
      pText = Text to your Segment Button
      pColor = Color of the Text
      pSize = Size of the Text

      Examples:
      objUI1.addButton("y","num 2",Colors.Red,18)
      objUI2.addButton("4","4",Colors.White,18)
      objUI3.addButton("5","E",Colors.Black,14)
    • _asview As PanelWrapper
      Return Panel Object from UISegment
    • _author As String
      Return the author of this library
    • _build (Width As Int, height As Int) As String
      Need build "AFTER" put all of segment buttons and Split to calculate sizes
      Example: objUI3.Build(250dip,50dip)
    • _getpressed As String
      Return the Pressed Segment
    • _initialize (vCallback As Object, ev As String, colorA As Int, colorB As Int) As String
      Initializes the object. You can add parameters to this method if needed.

      Examples:
      Dim objUI1 As UISegmented
      objUI1.Initialize(Me,"objUI2",Colors.ARGB(255,196,83,82),Colors.ARGB(255,216,29,8))

      Dim objUI3 As UISegmented
      objUI3.Initialize(Me,"objUI3",Colors.White,Colors.White)
    • _setpressedbytag (pTag As String) As String
      Force to pressed a segment button, identifing by TAG value
    • _setpressedbytext (pText As String) As String
      Force to pressed a segment button, identifing by TEXT value
    • _unpressall As String
      Unpress all of segment buttons
    • _version As String
      Return the version of this library
Version: 1.3

* Add a flag to invert colors when the button is push or not

V1.3 (First public release)
New flag added..... InvertedColors = True/False

2 UISegmented Samples with InvertedColors True and False:

With InvertedColors = TRUE

UISegmentedInvert4.png


With InvertedColors = FALSE (DEFAULT)


UISegmentedInvert5.png
 

Attachments

  • UISegmentTest1.zip
    6.5 KB · Views: 354
  • UISegmentTest2.zip
    10.3 KB · Views: 387
  • Library1.3.zip
    7.6 KB · Views: 335
  • Library1.2.zip
    7.5 KB · Views: 268
Last edited:

walterf25

Expert
Licensed User
Longtime User
Hello Dave,

I thing you need to use the 5o parameter on initialize, like this example, look the blue color.


objUI1.Initialize(Me,"objUI1",Colors.ARGB(255,80,137,224),Colors.ARGB(255,24,102,232),Colors.Blue,iCorLetraPressionado)
The Initialize method only requires 4 parameters, how can i add the parameters to change the pressed color?

Thanks,
Walter
 
Top