simple modal questions

Jerry Daniels mato.kola at wanblizaptan.com
Thu Jan 15 15:28:24 EST 2004


Doug,

(Again, sorry about the late posting on this one, too. Here is is...)

Here's one possible way to tackle your question number 2 (password 
entry so that you only see asterisks):

1. Make two editable (but empty) text fields called "password" and 
"password mask."
2. Hide "password" but keep "password mask" visible for text entry of 
the password.
3. Put these handlers into the visible field, "password mask":

on keyDown theKey
   --> FIND OUT WHAT'S SELECTED:
   put the selectedChunk into theChunk
   put word 2 of theChunk into theStartPos
   put word 4 of theChunk into theEndPos
   --> PUT ASTERISK INTO THE SELECTION IN VISIBLE MASK FIELD:
   put "*" into char theStartPos to theEndPos of fld "Password Mask"
   --> PUT REAL DATA INTO THE HIDDEN FIELD:
   put theKey into char theStartPos to theEndPos of fld "Password"
   focus on me
end keyDown

on keyUp
   --> GET THAT SELECTION GOING AGAIN:
   focus on me
   pass keyUp
end keyUp

on backspaceKey
   --> IF THEY HIT BACKSPACE...SAME IDEA AS KEYDOWN:
   put the selectedChunk into theChunk
   put word 2 of theChunk into theStartPos
   put word 4 of theChunk into theEndPos
   if theStartPos > theEndPos then
     put empty into char theEndPos of fld "Password Mask"
     put empty into char theEndPos of fld "Password"
   else
     put empty into char theStartPos to theEndPos of fld "Password Mask"
     put empty into char theStartPos to theEndPos of fld "Password"
   end if
   focus on me
end backspaceKey

on deleteKey
   --> IF THEY HIT DELETE...SAME IDEA AS KEYDOWN:
   put the selectedChunk into theChunk
   put word 2 of theChunk into theStartPos
   put word 4 of theChunk into theEndPos
   if theStartPos > theEndPos then
     put empty into char theStartPos of fld "Password Mask"
     put empty into char theStartPos of fld "Password"
   else
     put empty into char theStartPos to theEndPos of fld "Password Mask"
     put empty into char theStartPos to theEndPos of fld "Password"
   end if
   focus on me
end deleteKey

When you want the password, it will be in the hidden field "password", 
not "password mask."

Hope that helps,

Jerry Daniels

On Jan 12, 2004, at 8:58 PM, Doug Lerner wrote:

> (1) I assume that if you want to make a form (like a login form) that
> requires more than one answer, that the best way is to open a stack
> containing the form as modal? Is that right?
>
> (2) How do you make a text field into a "password" field (asterisked 
> out)?
>
> Thanks,
>
> doug
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution



More information about the use-livecode mailing list