charlieelliott785@hotmail
Member
in my testing i wanted to check a keypress for the enter (return) key. The documentation tells me:
KeyCode is the code of the pressed key, you can get them with the KeyCodes keyword.
so to make my life easier i typed in:
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
right out of the documentation. I get an error on KeyCodes.
which is:
Main - 50: Undeclared variable 'keycodes' is used before it was assigned any value.
So what a want is the mnemonic for the return key putting my cursor over KeyCodes yields a popup with the error. Am I missing a library? What am i doing wrong? When i do find the mnemonic for the return key I will use a statement similar to the IF statement in the sample quote and that is telling me the sample doesn't work. Why can't i get a list of the mnemonics.
Charlie
KeyCode is the code of the pressed key, you can get them with the KeyCodes keyword.
so to make my life easier i typed in:
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
right out of the documentation. I get an error on KeyCodes.
which is:
Main - 50: Undeclared variable 'keycodes' is used before it was assigned any value.
So what a want is the mnemonic for the return key putting my cursor over KeyCodes yields a popup with the error. Am I missing a library? What am i doing wrong? When i do find the mnemonic for the return key I will use a statement similar to the IF statement in the sample quote and that is telling me the sample doesn't work. Why can't i get a list of the mnemonics.
Charlie