Skip to content

Instantly share code, notes, and snippets.

@iArnold
Last active November 4, 2016 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iArnold/ccd980a4ed682cfc58fd356f4b81264e to your computer and use it in GitHub Desktop.
Save iArnold/ccd980a4ed682cfc58fd356f4b81264e to your computer and use it in GitHub Desktop.
Masked input
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