'Class module
Sub Class_Globals
Private mainPanel As Panel
Private statValue As Int
Private lblStat As Label
Private lblValue As Label
Private btnPlus As Button
Private btnMinus As Button
End Sub
Sub Initialize(sStatName As String, nValue As Int)
mainPanel.Initialize("")
lblStat.Initialize("")
lblValue.Initialize("")
lblStat.Gravity = Gravity.bottom
lblValue.Gravity = Gravity.bottom
btnMinus.Initialize("minus_button")
btnPlus.Initialize("plus_button")
btnMinus.Text = "-"
btnPlus.Text = "+"
lblStat.Text = sStatName
setValue(nValue)
mainPanel.AddView(lblStat, 0, 0, 80dip, 40dip)
mainPanel.AddView(lblValue, lblStat.Left + lblStat.Width + 1, 0, 40dip, 40dip)
mainPanel.AddView(btnPlus, lblValue.Left + lblValue.Width + 1, 0, 40dip, 40dip)
mainPanel.AddView(btnMinus, btnPlus.Left + btnPlus.Width + 1, 0, 40dip, 40dip)
End Sub
Sub getPanel As Panel
Return mainPanel
End Sub
Sub setValue(nVal As Int)
statValue = nVal
lblValue.Text = statValue
End Sub
Sub getValue As Int
Return statValue
End Sub
Sub minus_button_Click
setValue(statValue - 1)
End Sub
Sub plus_button_Click
setValue(statValue + 1)
End Sub