Ask Password and Login Screen

Peter M. Brigham, MD pmbrig at
Fri Aug 19 09:18:58 EDT 2011

On Aug 18, 2011, at 8:54 PM, John Tregea wrote:

> Hi,
> I used a different approach to this question as the bulleted text font
> didn't seem that secure. The following code just traps the characters
> entered into a field and replaces them with "*" while storing the actual
> string into a global variable.
> on openfield
>  global gThePass
>  put empty into gThePass
>    put empty into fld "password"
> pass openfield
> end openfield
> on keydown thekey
>  global gThePass
>  put thekey after gThePass
>  put "*" after field "Password"
> end keydown
> on backspacekey
>  global gThePass
>  put empty into fld "password"
>  put empty into gThePass
> end backspacekey
> on returninfield
>  global gTheUser
>  send mouseup to btn "Login"
>  exit returninfield
> end returninfield
> The only downside is that if the user makes a mistake and types a backspace
> they have to start all over again.

Just modify the backspace handler:

on backspacekey
    global gThePass
    delete char -1 of fld "password"
    delete char -1 of gThePass
end backspacekey

and it will work as you would expect.

-- Peter

Peter M. Brigham
pmbrig at

More information about the Use-livecode mailing list