Another version using !GET.KEY that just beeps if invalid characters are entered. Should be OK in most instances although !GET.KEY is not as good as the PI/Open implementation and does have some foibles, $INCLUDE UNIVERSE.INCLUDE GTI.FNKEYS.IH
PASSWD = '' LOOP CALL !GET.KEY(CHR, CODE) UNTIL CODE = FK$FIN DO BEGIN CASE CASE CODE = 0 CRT "*": PASSWD := CHR CASE CODE = FK$BSP AND PASSWD # '' CRT CHR:' ':CHR: PASSWD = PASSWD[1,LEN(PASSWD)-1] CASE 1 CRT @SYS.BELL: END CASE REPEAT CRT CRT PASSWD Cheers, Andy From: Bob Wyatt <bwyatt_...@comcast.net> To: 'U2 Users List' <u2-users@listserver.u2ug.org> Sent: Wednesday, 17 August 2011, 3:59 Subject: Re: [U2] Simple Masking of Password Input (Universe Basic) There was nothing in the request about validating the keys entered... So even if a backspace is pressed, throw the *... If there is a desire to test the validity of the character entered (it is within the allowed character range of this password - I.E., alpha-numeric or standard "special" characters [presumably]), I would probably use the !GET.KEY subroutine and presumably test the key entered against whichever is shorter - valid or invalid keys. If an errant character type is detected, advise the operator accordingly, wipe out the password, and make the operator retype from the beginning. This is not a test of the nth character entered compared to the nth character of the password - just whether the key pressed is valid; if it is valid, output the *. The documentation is a little lacking, but I believe that !GET.KEY does not do any of the limited character handling that KEYIN() will do. However, speedy does not come to mind when I think of everything entailed in doing this; the longer the password required, the less speedy it shall be. -----Original Message----- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of andy baum Sent: Tuesday, August 16, 2011 7:09 PM To: U2 Users List Subject: Re: [U2] Simple Masking of Password Input (Universe Basic) Slight amendment in case your positioned in middle of screen. PASSWD = '' LOOP CHR = KEYIN() UNTIL CHR = CHAR(13) DO BEGIN CASE CASE CHR # CHAR(8) CRT "*": PASSWD := CHR CASE PASSWD # '' CRT CHAR(8):' ':CHAR(8): PASSWD = PASSWD[1,LEN(PASSWD)-1] END CASE REPEAT CRT CRT PASSWD Cheers, Andy ________________________________ From: nschroth <ngschr...@yahoo.com> To: u2-users@listserver.u2ug.org Sent: Tuesday, 16 August 2011, 19:51 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 U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users _______________________________________________ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users _______________________________________________ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users _______________________________________________ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users