Re: Invisible entry
Posted in 1992
If your invisible attribute dosen't work, I have a suggestion that may work for entering a password. Start off by opening a form with a field the size of the largest password you want to enter. Then begin a loop with a prompt statement (PROMPT FOR CHAR). Directly after the user has entered a character of the password, add this character to string that holds all the characters currently entered. Then display a symbol like 'X' or '*' to the form field to show that input has been accepted. When the user presses return, the function is finished and you have a string containing the password. You could have this function in a loop with a counter giving the user x number of tries to get it right. If you compile this knocked-up code below, it may solve your problem. DATABASE formonly SCREEN { Enter a password [f001 ] } ATTRIBUTES f001 = formonly.form_mask; END FUNCTION get_passwd() DEFINE char_var CHAR(1), secret_passwd CHAR(7), mask_field CHAR(8), counter SMALLINT OPTIONS PROMPT LINE 1 OPEN WINDOW passwd_window AT 5,5 WITH FORM "passwd" ATTRIBUTE(BORDER) LET counter = 1 WHILE TRUE PROMPT "" FOR CHAR char_var IF char_var IS NULL THEN EXIT WHILE ELSE LET secret_passwd[counter,counter] = char_var LET mask_field[counter,counter] = "*" DISPLAY mask_field to form_mask LET counter = counter + 1 END IF END WHILE CLOSE WINDOW passwd_window RETURN secret_passwd END FUNCTION The only drawback to this function is that the cursor will be on the PROMPT line of the "" PROMPT statement, not on the form field. If you can live with this, then otherwise, it is ok. I used to use a function like this before the 4.1 release solved the INVISIBLE attribute problem, although I know a number of my clients have have upgraded to 4.1 and their termcap probs have not gone away. Hope this helps some, Keith.