Page 1 of 1

making a password field

Posted: Fri Dec 19, 2008 8:06 pm
by haitham
Hi,

I want a Text Entry Field for a password. I want stars appear in the field instead of the characters that are entered by the user.

Is there any straightforward way for doing that?

Thanks.
Haitham

Posted: Sat Dec 20, 2008 1:09 am
by SparkOut
There are various tutorials/tips/examples around, some here:

Eric Chatonet's http://www.sosmartsoftware.com/?r=revol ... ciels&l=en #12 about 2 thirds of the way down.

Mark Schonewille's http://economy-x-talk.com/developers.html near the bottom on the left.

Trevor DeVore's http://revolution.screenstepslive.com/s ... word-Field

There's plenty of other examples about, these are just ones I know of without going hunting too much. Have a look at them all, you can see the various techniques and approaches you can take.

Posted: Sat Dec 20, 2008 6:06 pm
by haitham
Thanks SparkOut,

I wrote, myself, a simple nice code that does the job easily.

The following code should be inside the Text Entry Field itself.
-------------------------------------------------------------------
on keyDown theKey
put "*" after last char of me
put theKey after last char of field "inpInvisible"
end keyDown

on backspaceKey
delete last char of me
delete last char of field "inpInvisible"
end backspaceKey
-------------------------------------------------------------------

Where the field "inpInivisible" is an invisible field that holds the real password entered by the user.

Note: this method doesn't work properly if the user tries to enter characters between the "stars" or if the user uses CTRL + V for pasting the password from somewhere else. I think the second problem can be solved by adding an: on controlKeyDown handler to handle that issue in a proper way.

Thanks anyway.
Haitham