Last active
November 4, 2016 13:37
-
-
Save iArnold/ccd980a4ed682cfc58fd356f4b81264e to your computer and use it in GitHub Desktop.
Masked input
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Red [ | |
filename: %maskinput.red | |
date: "4-Nov-2016" | |
Needs: 'View | |
] | |
star-replace: func [ | |
num | |
/local stars | |
][ | |
stars: copy "" | |
loop num [append stars "*"] | |
stars | |
] | |
hide-it: func [ | |
f [object!] | |
e [event!] | |
][ | |
case [ | |
e/key = 'delete [] | |
8 = to integer! e/key [ | |
print "BS key caught by field face!" | |
'stop | |
] | |
1 = 1 [;prin "keystroke caught: >" print e/key print "<" | |
;print e/key xor 0 | |
f/extra: append f/extra e/key | |
f/text: star-replace length? f/extra | |
print rejoin ["f/extra=" f/extra " f/data=" f/data] | |
] | |
] | |
] | |
view [ | |
f1: field "" extra "" | |
on-key [ | |
hide-it face event | |
] | |
on-key-up [ | |
; print "key-up now" | |
face/text: star-replace length? face/extra | |
] | |
button "Quit" [unview] | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment