Posts: 3,368
Threads: 195
Joined: Jan 2003
meh, it isn't as efficient as mine.
Besides, error codes are for wimps who don't use 16x800x600 bit resolution where PRINT statements crash the program
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."
Visit www.neobasic.net to see rubbish in all its finest.
Posts: 1,956
Threads: 65
Joined: Jun 2003
AGAMEMNUS,
You still haven't fixed your latest posted version.
What do you mean that error codes are for wimps? This may be true if you program is just for fun and never going to be put into production. Put yourself in a user's shoes. He inputs a piece of data and it's rejected with no corresponding error message. How is he supposed to figure out why?
You have to start thinking in terms of "production quality" programs. Let me tell you that more than 50% of the code and effort for applications that interface with users are devoted to security, entitlement, validation, error messages, and error logging.
*****
Posts: 3,368
Threads: 195
Joined: Jan 2003
I fixed my last version....
What I mean by "Error codes are for wimps" is that if a program were to be using this internally, (not "INPUT userinput$) it would be quite useless to point out the error it made -- better code it so that it doesn't make an error.
For users, an error code is still not justified. A better approach would be to NOT LET the user make an error by making a custom INPUT that only accepts the right stuff.
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."
Visit www.neobasic.net to see rubbish in all its finest.
Posts: 1,956
Threads: 65
Joined: Jun 2003
Quote:....A better approach would be to NOT LET the user make an error by making a custom INPUT that only accepts the right stuff.
What do you have in mind by a "custom INPUT" that only accepts thre right stuff? Give me an example.
*****
Posts: 3,368
Threads: 195
Joined: Jan 2003
well, I won't code it here since it's a pain, but the general idea is:
Code:
DO
IF instr$(chr$(13)+chr$(8)+"1234567890."), i$) <> 0 then..
end if
LOOP
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."
Visit www.neobasic.net to see rubbish in all its finest.
Posts: 1,956
Threads: 65
Joined: Jun 2003
AGAMEMNUS:
Looks like you're doing a kind of character checking. Which brings us back to the subject of having to send the user an error message if he types an invalid charcater. That's what the original routine was all about.
*****
Posts: 3,368
Threads: 195
Joined: Jan 2003
nay, the user can't enter an incorrect character.
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."
Visit www.neobasic.net to see rubbish in all its finest.
Posts: 1,956
Threads: 65
Joined: Jun 2003
AGA,
How do you inhibit the user from entering invalid data? I don't get it.
*****
Posts: 3,368
Threads: 195
Joined: Jan 2003
when the user presses any number except "0 1 2 3 4 5 6 7 8 9 . backspace" in the input field, just ignore that in your input function. After the user presses ".", ignore "." afterwards, as well. If nothing is entered after ".", then remove the ".".
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."
Visit www.neobasic.net to see rubbish in all its finest.
Posts: 1,956
Threads: 65
Joined: Jun 2003
AGAMEMNUS:
That's a wonderful idea you have, but how do you control what keys the user can hit? You cant by using any of the INPUT or INKEY$ commnds that I know? Please tell me how?
*****