Sub CreateListItem(Text As String, Width As Int, Height As Int) As Panel
Dim p As Panel
p.Initialize("")
p.Color = Colors.Black
' 1. das Label mit Text
Dim lbl As Label
lbl.Initialize("")
lbl.Gravity = Bit.OR(Gravity.CENTER_VERTICAL, Gravity.LEFT)
lbl.Text = Text
lbl.TextSize = 16
lbl.TextColor = Colors.White
' 2. der Button
Dim b As Button
b.Initialize("button") 'all buttons click events will be handled with Sub Button_Click
b.Text = "Info"
' 3. Die Gesamtlaufzeit RuntimeTotal
Dim RuntimeTotal As Label
RuntimeTotal.Initialize ("RuntimTotal")
RuntimeTotal.Text = "00000,00"
RuntimeTotal.TextSize = 12
RuntimeTotal.Gravity = Bit.OR (Gravity.CENTER_VERTICAL, Gravity.CENTER_HORIZONTAL )
RuntimeTotal.TextColor = Colors.Cyan
' 4. die CheckBox
Dim chk As CheckBox
chk.Initialize("chk")
p.AddView(lbl, 5dip, 2dip, 150dip, Height - 4dip) 'view #0
p.AddView(b, 155dip, 2dip, 60dip, Height - 4dip) 'view #1
p.AddView(RuntimeTotal,215dip,2dip,60dip, Height - 4dip) 'view2 (eigentlich die 3.)
p.AddView(chk, 280dip, 2dip, 50dip, Height - 4dip) 'view #3 (vormals die 2.)
Return p
End Sub
Sub chk_CheckedChange(Checked As Boolean)
Dim index As Int
index = clv3.GetItemFromView(Sender)
Dim pnl As Panel
pnl = clv3.GetPanel(index)
'Dim lbllbl As Label
lbllbl = pnl.GetView(2)
Dim chk As CheckBox
chk = pnl.GetView(3)
Dim lbllbltimer As Timer
' Works for a single Timer
If chk.Checked = True Then
lbllbltimer.Initialize ("lbllblTimer" ,1000)
lbllbltimer.Enabled = True
lbllbl.Text = lblblzeitvalue
End If
' Works not
If chk.Checked = False Then
lbllbltimer.Enabled = False
lbllbl.Text = lbllbl.Text
lblblzeitvalue = 0
End If
'Msgbox("Item value: " & clv3.GetValue(index) & CRLF & "Check value: " & chk.Checked, "")
End Sub
Sub lbllbltimer_Tick
lblblzeitvalue = lblblzeitvalue + 1
'ToastMessageShow(lblblzeitvalue, False)
lbllbl.Text = lblblzeitvalue
lbllbl.Invalidate
End Sub