making a password field

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
haitham
Posts: 6
Joined: Fri Dec 19, 2008 7:47 pm

making a password field

Post by haitham » Fri Dec 19, 2008 8:06 pm

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

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Sat Dec 20, 2008 1:09 am

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.

haitham
Posts: 6
Joined: Fri Dec 19, 2008 7:47 pm

Post by haitham » Sat Dec 20, 2008 6:06 pm

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

Post Reply