Try INPUT X,-1 to see if anything is in the input buffer, then KEYIN() to get a single keystroke. That will get the backspace. Depending on your needs, you may need to check the input buffer because KEYIN will sit there until the cows come home if there's nothing there. This is great (with a napping timed loop) for detecting multi-keystroke sequences such as function keys. It's been a number of years since I've worked with UV, so I don't remember whether it returns the actual keystroke or the ASCII value.

Regards,
Charlie Noah

On 08-18-2011 8:56 AM, nschroth wrote:
Thanks for the put-down, oh Senior Exhaulted Programmer Mecki.
Two useful ditties were included to remind we "juniors":
1) the user perspective is supreme - way too much code is generated by
"slick" programmers with total disregard for the user experience.
2) I did learn this morning that the backspace did not work and must be
addressed.

B.T.W, this is a simple enhancement request to our application login, and it
would be huge overkill to write a whole line-editor :-(

It is just a shame that U2 does not have a built-in function for this (like
many other languages).


Mecki Foerthmann wrote:
When I was a Junior programmer I wrote pretty much the same piece of code.
Unfortunately the users hated it!
For the sake of displaying something when they typed a password they
lost the ability to correct typing mistakes.
Because with INPUT,1 the Backspace key doesn't work!
So I had to go back to the drawing board and eventually ended up writing
a Line Editor ;-).

On 17/08/2011 18:15, nschroth wrote:
Thanks for all the suggestions.  I went with a variation, using ECHO
OFF/ON
and and specific screen position for the input.  Had problems detecting
CHAR(13). Learned that INPUT @ screws up things, so utilized the CRT@ for
positioning.  I'll look into adding backspace handling next. Here is what
I
ended up with:

PROMPT ''
INCHAR='X'
PASSWD=''
CRT @(0,5):'Enter Password: ':
ECHO OFF
POS=16
LOOP UNTIL INCHAR=''
CRT @(POS,5):
INPUT INCHAR,1:
PASSWD:=INCHAR
CRT @(POS,5):'*'
POS+=1
REPEAT
ECHO ON



Israel, John R. wrote:
That's actually pretty good!


John Israel
Senior Programmer/Analyst
Dayton Superior Corporation
1125 Byers Road
Miamisburg, OH  45342

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Mark Eastwood
Sent: Tuesday, August 16, 2011 3:43 PM
To: U2 Users List
Subject: Re: [U2] Simple Masking of Password Input (Universe Basic)

Just a quick sample

    PROMPT ''
    PW=''
    ECHO OFF
    LOOP
       INPUT X,1:
       IF X = '' THEN EXIT
       IF X THEN PRINT '*':
       PW := X
    REPEAT
    ECHO ON
    PRINT
    PRINT PW


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of nschroth
Sent: Tuesday, August 16, 2011 1:52 PM
To: [email protected]
Subject: [U2] Simple Masking of Password Input (Universe Basic)


Does anyone have a simple routine for entering a password and only
displaying an asterisk for the character entered?
--
View this message in context:
http://old.nabble.com/Simple-Masking-of-Password-Input-%28Universe-Basic
%29-tp32274238p32274238.html
Sent from the U2 - Users mailing list archive at Nabble.com.

_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users

_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users


_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users


_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to