B4A Library [B4X] [XUI] AS Checkbox

This is a simple cross platform Checkbox.

I spend a lot of time in creating views, like this and to create a high quality view cost a lot of time. If you want to support me and further views, then you can do it here by Paypal. :)
B4j: jXUI,JavaObject
B4a: XUi,StringUtils,XUI Views (2.40+)
B4i: iXUI,XUI Views (2.40+)

Screenshot_20200903-003723.jpg
Screenshot_20200903-003753.jpg
ezgif.com-crop.gif

2020-09-03-10-17-41.gif
20-09-03-10-24-58.gif

Disabled style:
Screenshot_20201127-101856.jpg


ASCheckbox
Author: Alexander Stolte
Version: 1.07

  • ASCheckbox
    • Events:
      • CheckedChange (Checked As Boolean)
    • Fields:
      • mBase As B4XView
      • Tag As Object
    • Functions:
      • Class_Globals As String
      • DesignerCreateView (Base As Object, Lbl As Label, Props As Map) As String
        Base type must be Object
      • Initialize (Callback As Object, EventName As String) As String
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • setBorderCornerRadius (radius As Int) As String
      • setBorderWidth (width As Int) As String
      • setChecked (b_checked As Boolean) As String
      • setCheckedBackgroundColor (crl As Int) As String
      • SetIcon (icon As String, isfontawesome As Boolean) As String
    • Properties:
      • BorderCornerRadius
      • BorderWidth
      • Checked
      • CheckedBackgroundColor
Changelog
  • 1.00
    • Release
  • 1.01
    • Add CheckedAnimated
    • B4J BugFix Label Size was resizing if the font was to big
  • 1.02
    • Add HapticFeedback
  • 1.03
    • Checked was readonly
  • 1.04
    • Add DisabledBackgroundColor property and designer property
    • Add DisabledIconColor property and designer property
    • Add Enable property - enable or disable the view
      • Screenshot_20201127-101856.jpg
    • no animation if you change the checked state via code
  • 1.05
    • B4I No Jump animation if the BorderCornerRadius > 0 (the radius cannot be held during animation, so it looks buggy when you have e.g. a circle)
    • BugFix - Enabled = False, now the view is disabled, no touch gestures allowed
  • 1.06
    • Intern Function IIF renamed to iif2
  • 1.07
    • Add DesingerProperty Checked - if true then the checkbox is checked
    • Add DesingerProperty Enabled - if false then the checkbox is disabled
      • On B4A and B4J the core enabled property in the designer is not used anymore
    • BugFixes
    • Intern Function iif2 removed and the core iif is now used
      • B4A V11+ - B4J V9.10+ - B4I V7.50+
Have Fun :)
 

Attachments

  • AS Checkbox Example.zip
    177.7 KB · Views: 230
  • ASCheckbox.b4xlib
    3.2 KB · Views: 101
Last edited:

netsistemas

Active Member
Licensed User
i testint and get this error:
B4A Versión: 10.0
Java Versión: 8
Parseando código. Error
Error al analizar el programa.
Descripción del error: Variable 'xuiviewsutils' no declarada se utiliza antes de que se le haya asignado cualquier valor.
Ha ocurrido un error en la línea: 184 (ASCheckbox)
If g_Haptic Then XUIViewsUtils.PerformHapticFeedback(mBase)

libraris used are: aschecbox (1.03), baxpages 1.05, core 9.9, stringutils 1.12, xui 2.0, xui vies 2.35
 

Bob Spielen

Active Member
Licensed User
Helo, trying to catch the ASCheckbox in a CLV Panel with
B4X Finding AsCheckBox in a CustomListView:
For i=0 To CLV_Capex.Size-1
        CLV_Item_Pan = CLV_Capex.GetPanel(i)
        For Each v As B4XView In CLV_Item_Pan.GetAllViewsRecursive
            Try
                Dim Cbx As ASCheckbox
                Cbx.Initialize(Me, "Cbx_IsChecked")
                Cbx.mBase = v
                Log(v Is CheckBox)
                Log("CBX.Checked = " & Cbx.Checked)
            Catch
               
            End Try
           
           
            Log(v)
           
            'If v Is CheckBox Then
            'End If
           
        Next
       
        Log("Stop")
       
    Next

What kind is the view in order to catch it?
 

angel_

Well-Known Member
Licensed User
Helo, trying to catch the ASCheckbox in a CLV Panel with
B4X Finding AsCheckBox in a CustomListView:
For i=0 To CLV_Capex.Size-1
        CLV_Item_Pan = CLV_Capex.GetPanel(i)
        For Each v As B4XView In CLV_Item_Pan.GetAllViewsRecursive
            Try
                Dim Cbx As ASCheckbox
                Cbx.Initialize(Me, "Cbx_IsChecked")
                Cbx.mBase = v
                Log(v Is CheckBox)
                Log("CBX.Checked = " & Cbx.Checked)
            Catch
             
            End Try
         
         
            Log(v)
         
            'If v Is CheckBox Then
            'End If
         
        Next
     
        Log("Stop")
     
    Next

What kind is the view in order to catch it?
Try this

B4X:
For Each v As B4XView In CLV_Item_Pan.GetAllViewsRecursive
    If v.Tag Is ASCheckbox Then
        Dim Cbx As ASCheckbox = v.Tag
        Log("CBX.Checked = " & Cbx.Checked)
    End If
Next
 

Bob Spielen

Active Member
Licensed User
Try this

B4X:
For Each v As B4XView In CLV_Item_Pan.GetAllViewsRecursive
    If v.Tag Is ASCheckbox Then
        Dim Cbx As ASCheckbox = v.Tag
        Log("CBX.Checked = " & Cbx.Checked)
    End If
Next
It worked!!!! Tks a lot...you are "The Angel" of the day


Look this to understand what happened.
 
Last edited:

AllanH

Member
Licensed User
Nice checkbox.
Unfortunately setting Checked = True after loading the layout results in the box filled with the checked colour but no white tick.
I'd love to use it but I need a tickbox that defaults to ticked.

Many thanks

Allan
 

AllanH

Member
Licensed User
Sorry B4i
The only alteration to your example is I added this
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    Dim v As View
    Root = Root1
    Root.LoadLayout("frm_main")
    ASCheckbox1.Checked = True
End Sub
 

ShaneG30

Well-Known Member
Licensed User
I loaded the library (B4J) and immediately got errors.

The errors:
1603913960233.png


I have loaded dependencies:
1603913992773.png
 

ShaneG30

Well-Known Member
Licensed User
I've added XUI Views and I still get the errors.

1603925651669.png
 
Top