Hello, guys...
I'm working on the following code and the IF clause (If wKey.Tag = wTunesApp(wIndex) Then) always returns false. The Tag field values are 0, 1, 2 and 3... and wTunesApp(wIndex) = rnd(0, 4).
I know that rnd() returns an int and Tag is a string... That could explain the false result on the IF, then I tried to use NumberFormat2(Rnd(0, 4),1,0,0,False) to convert to string, but still the IF clause returns false.
Don't know what to do.
Attached you may find the whole project.
Regards,
Fernando
I'm working on the following code and the IF clause (If wKey.Tag = wTunesApp(wIndex) Then) always returns false. The Tag field values are 0, 1, 2 and 3... and wTunesApp(wIndex) = rnd(0, 4).
I know that rnd() returns an int and Tag is a string... That could explain the false result on the IF, then I tried to use NumberFormat2(Rnd(0, 4),1,0,0,False) to convert to string, but still the IF clause returns false.
Don't know what to do.
Attached you may find the whole project.
Regards,
Fernando
B4X:
Sub lblButton_Click
wKey = Sender
Log("lblButton_Click: Tecla User " & wKey.tag)
wKey.Color = wTabColorON(wKey.Tag) ' Light Color
PlayTune(wKey.Tag)
wKey.Color = wTabColorOFF(wKey.Tag) ' Dark Color
If wKey.Tag = wTunesApp(wIndex) Then
Log("Clicou Certo")
GetNewKey
APPplayTunes
Else
Log("lblButton_Click: " & wIndex & ") Clicou Errado: " & wKey.Tag & " deveria ser " & wTunesApp(wIndex))
wCtError = wCtError + 1
If wCtError > 3 Then
Msgbox("You missed 3 tunes", "Game Over")
GameOver
Else
Msgbox("Wrong Key sequence", "Try Again")
APPplayTunes
End If
End If
End Sub