AdelCraft wrote:
*Sorry for the bad English
Is there a way to accept only letters in a user input like when ALPHA is locked?
For example, when I press the "Math" button, I would like "A" to be written instead of opening the math menu.
Thanks in advance.
In pure basic, no, however, there are 2 different types of alpha lock. There is the regular alpha lock which is accessed by pressing 2nd ALPHA and there is a 2nd version that can only be disabled through 2nd MODE. If you are willing to use a hex opcode, you can enable the 2nd type of lock, which makes it harder for people to enter something that isn't uppercase letters. Here is the opcode if you want to go that route:
Code: AsmPrgmFD3612D1C9
The other option would be to let the user input whatever they want and then accept only uppercased inputs in pure basic like this:
Code: Lbl A
Input "",Str1
0->A
For(X,1,length(Str1
If not(inString("ABCDEFGHIJKLMNOPQRSTUVWXYZ",sub(Str1,X,1)
1->A
End
If A=1
Disp "Only uppercase letters please"
If A=1
Goto A
You can also combine both like this...
Code: Lbl A
Asm(prgmUP
Input "",Str1
0->A
For(X,1,length(Str1
If not(inString("ABCDEFGHIJKLMNOPQRSTUVWXYZ",sub(Str1,X,1)
1->A
End
If A=1
Disp "Only uppercase letters please"
If A=1
Goto A
where prgmUP contains the opcode:
AsmPrgmFD3612D1C9