|
|
|
| 28 March 2002 | FillWithAsterisk() |
| Author | Humberto Roche-García(Puerto Rico) |
| Action | Displays asterisks while user enters password. |
| Syntax | FillWithAsterisk (StartRow) -or- FillWithAsterisk (StartRow, ForegroundColor, BackgroundColor) |
| Parameters | |
| Remarks | Helps in case you are entering/writting interactively an "On screen password". combined in Upper case letters, Lower case letters, numbers, Shift+1 or 2 or 3, etc = ! or @ or #, Shift+, or . or / = < or > or ?, etc Keys used to finish password entry are: ENTER, TAB, FKeys, Backspace, Esc. Keys not allowed as entry are: Arrows: UP, DOWN, LEFT, RIGHT, Keys: Insert, Delete, Home, End, PgUp, PgDown |
| Returns | Returns the password entered Returns 0 if no password is entered |
| Dependencies | ValidColor() and AllTrim() (created by me now part of KIX2001 as TRIM) |
| Examples | ; This will NOT display the password returned from the function since it is now on the variable $LOCO $loco = FillWithAsterisk(3,"w+","r") GET $x COLOR w/n CLS At(22,1) "Password is: " At(22,16) $loco At(21,1) " " At(21,1) Asc($fxxx) ; This will NOT display the password returned from the function since it is now on the variable $LOCO $loco = FillWithAsterisk(5,"w+","w") GET $x COLOR w/n CLS At(22,1) "Password is: " At(22,16) $loco At(21,1) " " At(21,1) Asc($fxxx) ; This will NOT display the password returned from the function since it is now on the variable $LOCO $loco = FillWithAsterisk(15,"w-","w") GET $x COLOR w/n CLS At(22,1) "Password is: " At(22,16) $loco At(21,1) " " At(21,1) Asc($fxxx) ; This will display the password returned from the function since it is not on the variable $LOCO $loco = FillWithAsterisk(7,"+","n") GET $x COLOR w/n At(22,1) "Password is: " At(22,16) $loco At(21,1) " " At(21,1) Asc($fxxx) GET $x |
| Source |
FUNCTION FillWithAsterisk ($fmsgrow, OPTIONAL $fforcolor, OPTIONAL $fbaccolor)
;
; Created by Humberto Roche-García
; Senior Programmer Analyst
; Citibank, N. A. - Technology Division, Puerto Rico
; E-Mail = hrgymcmm@caribe.net or hrgymcmm@hotmail.com
; Home Tel. (787) 703-1579
; Off. Tel. (787) 766-3870 X. 3397
; Created at my home PC
;
; NOTE: This will help you in case something needs for you to enter
; a password not to be displayed on screen.
; Keys used to finish password entry are:
; ENTER, TAB, FKeys, Backspace, Esc
; Keys not allowed as entry are:
; Arrows: UP, DOWN, LEFT, RIGHT
; Keys: Insert, Delete, Home, End, PgUp, PgDown
;
; RETURNS:
; Displays asterisks while user enters password combined in
; Upper case letters, Lower case letters, numbers, Shift+1 or 2 or 3, etc = ! or @ or #, etc,
; Shift+, or . or / = < or > or ?, etc
;
; Returns the password entered
; Returns 0 if no password is entered
;
; UDF Dependencies: ALLTRIM(), VALIDCOLOR()
$debugfunc = "Y" ; Only set this to "N" when running in a production environment!!!!!!
$fcolorset = validcolor($fforcolor,$fbaccolor)
Execute('COLOR $FCOLORSET')
At($fmsgrow,1) "To finish, press FKey or TAB or ESC or SPACEBAR or ENTER."
At($fmsgrow + 1,1) "Enter Password: "
$fasterisk = "*"
$fcntaster = 17
$fxxx = ""
$fxx = ""
DO
At($fmsgrow + 1, $fcntaster)
GET $fxxx
; To avoid SPACE(Ascii=8) or ENTER Key(Ascii=13) or SPACE Key(Ascii=32) or TAB Key(Ascii=9) or ESC Key(Ascii=27) or FKeys($FXXX="")
IF Asc($fxxx) = 8 OR Asc($fxxx) = 13 OR Asc($fxxx) = 32 OR Asc($fxxx) = 9 OR Asc($fxxx) = 27 OR $fxxx = ""
$fxxx = ""
ELSE
; Everytime the user hits arrow keys(Up, Down, Left Right) performs a double get
; This if is in order to avoid that double get and can be proven if you set
; the Variable $DEBUGFUNC to "Y" :
; as UP arrow(Ascii=224 + H=Ascii 72), DOWN arrow(Ascii=224 + P=Ascii 80)
; as LEFT arrow(Ascii=224 + K=Ascii 75), RIGHT arrow(Ascii=224 + M=Ascii 77)
IF Asc($fxxx) = 224
$fxxx = ""
GET $fxxx
ELSE
At($fmsgrow + 1, $fcntaster) $fasterisk
; In case you want to DEBUG the Function
IF Ucase($debugfunc) = "Y"
At(20,1) " "
At(20,1) $fxxx
At(21,1) " "
At(21,1) Asc($fxxx)
ENDIF
$fxx = $fxx + $fxxx
$fcntaster = $fcntaster + 1
BEEP
ENDIF
ENDIF
UNTIL Len(alltrim($fxxx)) = 0
IF $fcntaster < 18
MessageBox("No Password entered!","ERROR: Password",16)
$fillwithasterisk = 0
RETURN
ELSE
$fillwithasterisk = $fxx
ENDIF
ENDFUNCTION ; - FillWithAsterisk -
|
|
|
|