I copied this code right from the
B4X Language Booklet. I get this error:
Error parsing program.
Error description: Undeclared variable 'keycodes' is used before it was assigned any value.
Error occurred on line: 29 (Main)
If KeyCode = KeyCodes.KEYCODE_BACK Then
I am "trying" to learn this VB Dialect and i have no idea how to solve this problem.
Any help would be appreciated.
Charlie
Sub Activity_KeyPress(KeyCode As Int) As Boolean
Private Answ As Int
Private Txt As String
If KeyCode = KeyCodes.KEYCODE_BACK Then ' Checks if KeyCode is BackKey
Txt = "Do you really want to quit the program ?"
Answ = Msgbox2(Txt,"A T T E N T I O N","Yes","","No",Null)' MessageBox
If Answ = DialogResponse.POSITIVE Then ' If return value is Yes then
Return False ' Return = False the Event will not be consumed
Else ' we leave the program
Return True ' Return = True the Event will be consumed to avoid
End If ' leaving the program
End If
End Sub