B4A Library [B4X] [XUI] AS Checkbox

LWGShane

Well-Known Member
Licensed User
Longtime User

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 1.04
    • Add DisabledBackgroundColor property and designer property
    • Add DisabledIconColor property and designer property
    • Add Enable property - enable or disable the view
  • no animation if you change the checked state via code
Tip: if you uncheck the view "Enable" Property in the designer then the view is disabled
 

red30

Well-Known Member
Licensed User
Longtime User
When I add text in designer, it doesn't show up in ASCheckbox. Why? Is it possible to somehow add text after the "checkmark"?
I cannot get the index when ASCheckbox is in CustomListView.
B4X:
Sub ASCheckBox1_CheckedChange(Checked As Boolean)
    Dim index As Int = allclv.GetItemFromView(Sender)
    Log(index)
End Sub
I get an error:
B4X:
mod4_ascheckbox1_checkedchange (java line: 609)
java.lang.ClassCastException: red.123.ascheckbox cannot be cast to android.view.View
    at anywheresoftware.b4a.objects.B4XViewWrapper.asViewWrapper(B4XViewWrapper.java:89)
    at anywheresoftware.b4a.objects.B4XViewWrapper.getParent(B4XViewWrapper.java:186)
    at b4a.example3.customlistview._getitemfromview(customlistview.java:413)
    at red.ap.expert.bestapp.mod4._checkbox11_checkedchange(mod4.java:609)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
    at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:1082)
    at anywheresoftware.b4a.keywords.Common.CallSubNew2(Common.java:1037)
    at red.ap.expert.bestapp.ascheckbox._checkedchange(ascheckbox.java:298)
    at red.ap.expert.bestapp.ascheckbox$ResumableSub_Check.resume(ascheckbox.java:285)
    at anywheresoftware.b4a.keywords.Common$13.run(Common.java:1704)
    at android.os.Handler.handleCallback(Handler.java:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6865)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:504)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
How can I get the index?
 

Alexander Stolte

Expert
Licensed User
Longtime User
When I add text in designer, it doesn't show up in ASCheckbox. Why?
Because the view is only the checkbox, not checkbox + text.
Add a simple label after the checkbox and done.

Sub ASCheckBox1_CheckedChange(Checked As Boolean) Dim index As Int = allclv.GetItemFromView(Sender) Log(index) End Sub
i dont know what this code does, but it should be this:
B4X:
Sub ASCheckBox1_CheckedChange(Checked As Boolean)
    Dim tmp_checkbox As ASCheckBox = Sender
    Dim index As Int = allclv.GetItemFromView(tmp_checkbox.mBase)
    Log(index)
End Sub
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 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
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 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+
 
Last edited:

LWGShane

Well-Known Member
Licensed User
Longtime User
Intern Function iif2 removed and the core iif is now used
  • B4A V9.10+ - B4J V9.10+ - B4I V7.50+

IIf was introduced with B4A 11.0. (Also B4A 9.10 doesn't exist.)
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 1.09
    • Add Event property - If False then the CheckedChange event is not triggered
This is useful if you want to check checkboxes in the code, but don't want the code to be triggered in the event, because you would then make an INSERT statement, for example.
 

cyware

New Member
Licensed User
Longtime User
Nice one but: would it be difficult to expose the top/left etc fields? Sometimes you want to move it programmatically.
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 2.00
    • Add Designer Property FillUncheckedBackgroundColor
    • Add Designer Property UncheckedBackgroundColor
    • Add Designer Property UncheckedIconColor
    • Add Designer Property Round
      • Default: False
    • Add set Theme
    • Add get Theme_Dark
    • Add get Theme_Light
    • Add Designer Property ThemeChangeTransition
      • Default: None
Round
Make your checkbox round


Theming
as in almost all of my views, there is now a built-in dark/light mode that you can easily customize yourself
B4X:
ASCheckbox1.Theme = ASCheckbox1.Theme_Light
B4X:
ASCheckbox1.Theme = ASCheckbox1.Theme_Dark

FillUncheckedBackgroundColor
If the checked = False

  • If False, then only the border is filled with the color
  • If True, the checkbox is filled with the color
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…