*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.
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

You could create your own user input routine using the getKey and Output( commands.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement