B4i Library [Class] Checkbox

This class is similar to the Spinner class I posted earlier. I wrote it to simplify porting a B4A app to B4i.

This class mimics the B4A Checkbox programming interface, but is implemented using a B4i Switch so that it visually looks like it belongs in iOS.

The class expects the same _CheckedChange callback as the B4A Checkbox, and implements all of the B4A Checkbox methods EXCEPT for the following:
  • Background
  • Invalidate
  • Invalidate2
  • Invalidate3
  • SetBackgroundImage
  • SetColorAnimated
  • SetTextColorAnimated
  • SetTextSizeAnimated
  • SetVisibleAnimated
The following methods have been added:
  • SetCallbackModule - By default the class assumes that the callback routine is in the Main module. If it isn't you must call SetCallbackModule to set the module it is in. eg spr.SetCallbackModule(Me)
  • View - returns the underlying Panel used in the Checkbox class. Useful for changing it's attributes directly, or adding the Checkbox to a parent view. eg:
B4X:
myPanel.Addview (cbx.View, 0, 0, 20, 10)
  • Label - Similar to View but returns the label containing the Checkbox text
  • UpdateLayout - must be called after the Checkbox is added to a parent view
  • SetBorder - Set the border of the underlying label
  • TextAlignment - attribute to get/set the alignment of the text in the underlying label.
  • SetCheckedAnimated
I hope this is of some use.

Hugh
 

Attachments

  • Checkbox0.02.zip
    6.8 KB · Views: 198
Last edited:
Top