Probably a very simple explanation, but I cant get any Button_Click events when a button is pressed on the Custom List View.
I get ItemClick events so not sure why button is ignored (button does change color on press)
All suggestions appreciated.
FP
I get ItemClick events so not sure why button is ignored (button does change color on press)
B4X:
Sub Button_Click
Dim index As Int
Dim pnl As Panel
Dim btn As Button
index = clvPlayers.GetItemFromView(Sender)
pnl = clvPlayers.GetPanel(index)
btn = pnl.GetView(1)
Log("Test1 " & index)
If OffOnGoalie(index) = 1 Then
OffOnGoalie(index) = 0 ' If ON then OFF
btn.Text = "OFF"
Else If OffOnGoalie(index) = 0 Then
OffOnGoalie(index) = 1 ' If OFF then ON
btn.Text = "ON"
End If
End Sub
Sub clvPlayers_ItemClick(Index As Int, value As Object) ' Click on list centre label selects this player as the goalie
Dim pnl1 As Panel
Dim pnl2 As Panel
Dim btn1 As Button
Log("Test2 " & Index)
Dim num As Int
num = Index + 1
Dim val As Int
val = Msgbox2("Player " & num & " New Goalie?", "Bombers", "Yes", "Cancel", "", Null)
If val = DialogResponse.POSITIVE Then
For i = 0 To NumberofPlayers - 1
If OffOnGoalie(i) = 2 Then ' Clear any goalies currently registered
OffOnGoalie(i) = 0
pnl2 = clvPlayers.GetPanel(i)
btn1 = pnl2.GetView(1) ' 3rd view is button
btn1.Text = "OFF" ' This Goalie taken OFF
End If
Next
pnl1 = clvPlayers.GetPanel(Index)
OffOnGoalie(Index) = 2 ' Set new goalie
btn1 = pnl1.GetView(1) ' 3rd view is button
btn1.Text = "GOALIE" ' New Goalie put ON
Log(Index & " = " & value)
End If
End Sub
All suggestions appreciated.
FP