'Custom View class
#Event: ValueChanged (Value As Boolean)
#DesignerProperty: Key: CheckBoxValue, DisplayName: Checked, FieldType: Boolean, DefaultValue: False, Description: CheckBox value.
#DesignerProperty: Key: CheckBoxDotColor, DisplayName: Dot Color, FieldType: Color, DefaultValue: 0xFFFF0000, Description: CheckBox dot color
Sub Class_Globals
Private mEventName As String 'ignore
Private mCallBack As Object 'ignore
Private mBase As Panel
Private Const DefaultColorConstant As Int = -984833 'ignore
Private dotPanel As Panel
Private isValue As Boolean
Private dotColor As ColorDrawable
End Sub
Public Sub Initialize (Callback As Object, EventName As String)
mEventName = EventName
mCallBack = Callback
End Sub
Public Sub DesignerCreateView (Base As Panel, Lbl As Label, Props As Map)
Dim clr As Int
mBase = Base
dotPanel.Initialize("Click")
isValue=Props.Get("CheckBoxValue")
If isValue = True Then
clr = Props.Get("CheckBoxDotColor")
Else
clr = Colors.White
End If
dotColor.Initialize(clr, 2)
dotPanel.Background = dotColor
mBase.AddView(dotPanel,4dip,4dip,mBase.Width-8dip, mBase.Height-8dip)
End Sub
Public Sub GetBase As Panel
Return mBase
End Sub
public Sub dotPanel_Click
CallSub(mCallBack, mEventName & "_" & "ValueChanged")
End Sub
Sub b4aCheckBox1_ValueChanged (Value As Boolean)
ToastMessageShow("CheckBox was clicked !",False)
End Sub