Sub AddCheckBoxItem(Title As String, CheckedDetail As String, UncheckedDetail As String, Checked As Boolean)
Dim P As Panel
Dim lblTitle, lblDetail As Label
Dim chkBox As CheckBox
Dim su As StringUtils
P.Initialize("Preference")
svPreferences.Panel.AddView(P, 0, svPosition, (svPreferences.Panel.Width - 48dip), ItemHeight)
P.Tag = Title
lblTitle.Initialize("")
lblTitle.Text = Title
P.AddView(lblTitle, 10dip, 10dip, (svPreferences.Panel.Width - 48dip), 30dip)
lblTitle.Tag = "Title"
lblDetail.Initialize("")
If Checked = True Then
lblDetail.Text = CheckedDetail
Else
lblDetail.Text = UncheckedDetail
End If
P.AddView(lblDetail, 10dip, 40dip, svPreferences.Panel.Width, 30dip)
lblDetail.Height = su.MeasureMultilineTextHeight(lblDetail, lblDetail.Text)
lblDetail.Tag = "Detail"
chkBox.Initialize("ChkBox")
P.AddView(chkBox, P.Width - 20dip - 48dip, lblTitle.Top, 48dip, 48dip)
chkBox.Tag = "Check"
If (lblTitle.Height + lblDetail.Height + 4dip) > ItemHeight Then
P.Height = lblTitle.Height + lblDetail + 4dip
End If
End Sub