Author |
Message |
dairyman_crick
|
Posted: Fri May 28, 2004 3:46 pm Post subject: how to enter a pin number |
|
|
hi,
I'm currently making a security program which needs a pin number. However, the pin number has to be appear as "*****". How can I enter numbers yet make them look like symbols? Any suggestion is appreciated.
Thanks. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
guruguru
|
Posted: Fri May 28, 2004 3:51 pm Post subject: (No subject) |
|
|
If you're using GUI it's very simple. Use GUI.SetEchoChar (yourWidget, "*"). This auotmatically puts in stars instead of characters.
Otherwise...
This gets harder. Basically, when a key is presed, you manually put a "*", and add the pressed key to a declared string.
code: |
var ch : string (1)
var code : string := ""
put "Password: " ..
loop
getch (ch)
put "*" ..
code += ch
end loop
|
You can change the loop to a for loop to limit the number of letter inputted. At the end of the loop, code is the password the user has inputted. |
|
|
|
|
|
Cervantes
|
Posted: Fri May 28, 2004 6:42 pm Post subject: (No subject) |
|
|
you'll notice those that pressing enter counts as a part of your pin number. to fix this:
insert
code: | exit when ch = chr (10) |
just after "getch (ch)"
and just before "put "*" .." |
|
|
|
|
|
xmdxtreme
|
Posted: Fri May 28, 2004 8:19 pm Post subject: (No subject) |
|
|
Heres the code that i made for my project and im using now this is good cause backspace works too.
code: |
procedure password1
var temp1 : string
var chp : string (1)
password := ""
put "Enter your password: " ..
loop
getch (chp)
if ord (chp) = 10 then % 10 is code for enter... exit in this case
exit
elsif ord (chp) = 8 and length (password) >= 1 then % if it is backspace
temp1 := password
password := ""
locate (whatrow, whatcol - 1)
put " " ..
locate (whatrow, whatcol - 1)
for q : 1 .. length (temp1) - 1
password += temp1 (q)
end for
else
password := password + chp
put "*" ..
end if
end loop
put ""
cls
end password1 |
|
|
|
|
|
|
dairyman_crick
|
Posted: Sun May 30, 2004 1:36 pm Post subject: (No subject) |
|
|
It worked!!! ...thank u so much...saved my day! |
|
|
|
|
|
Andy
|
Posted: Tue Jun 01, 2004 8:25 pm Post subject: (No subject) |
|
|
you should do a search first before posting for help... alot of common procedures such as this are in the turing source codes.. i wrote a masking program long time ago and submitted it |
|
|
|
|
|
|