[REBOL] Re: [view] field, input filter hook !
From: moliad::aei::ca at: 27-Aug-2006 23:10
hi again,
Using the little patch I released yesterday, I tought I'd release
another little input hook function which is also very usefull... an
input filter. Use this to create integer or decimal field boxes, just
replace the key-hook in last example by this one and you get a field
which only accepts decimal characters (plus arrows, tab, enter, esc,
home, end).
changing the characters in charset, you can adapt this filter to what
you need.
have fun!
-MAx
;--------------------------------------------------
chars: charset [#"0" - #"9" "."]
key-hook: func [
face
event
/local ignore
][
if any [
ignore: parse to-string event/key [chars]
ignore: found? find [#"^M" #"^-" up down left right home end]
event/key
event/key = #"^["
][
unless ignore [
unfocus face
]
]
not ignore
]