B4A Library UISegmentedControl

Alberto Iglesias

Well-Known Member
Licensed User

This library was made based on UISegmentedControl for IOS



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



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)



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



With InvertedColors = FALSE (DEFAULT)


 

Attachments

Last edited:

NJDude

Expert
Licensed User
Nice.

Would it be possible you translated the following to keep it kosher?
B4X:
CorFonte As Int

TamFonte As Int

Texto As String
 

CidTek

Active Member
Licensed User
Last edited:

CidTek

Active Member
Licensed User
OK CidTek,

I do this library with this design based. In some days I put in the forum...

I think it will help you and others users.
Thank you! And for those of us that port our apps to Blackberrys it will even have a native look on those platforms.
 

billyrudi

Active Member
Licensed User
Hi Alberto,
i have need to change the logic of the colors in your control. then selected one must be on e the other grayed.
can you develop a flag to invert the selection?
regards Paolo Lops
 

billyrudi

Active Member
Licensed User
Hi Alberto you are great!.
Are you sure that the library1.3.zip is correct?
i don't see your flag...
 

Dave O

Active Member
Licensed User
Is there a way to set the selection color? (It currently seems fixed as a dark gray.)

Basically, I'd like to create a control like the red/white one in the lower left of the graphic in the first post (unselected = white, selected = color).
 
Top