[REBOL] Re: feel engage not 'feeling' to well......
From: philb:upnaway at: 18-Jun-2004 10:34
Just to expand a litle more (adding 'home, 'end, select all, copy, cut, delete, backspace).
my-styles: stylize [
rfield: field font [name: font-fixed]
feel [engage: func[face action event /local pass] [
; print event/type
pass: does[ctx-text/edit/engage face action event]
if event/type = 'key [
ch: event/key
; probe ch
if ch = 'left [pass exit]
if ch = 'right [pass exit]
if ch = 'home [pass exit]
if ch = 'end [pass exit]
if find face/single-chars ch [if find face/data ch [exit]]
if find "^A^C^H^X^~^-" ch [pass exit]
if not find face/allow-chars ch [exit]
]
pass
]
]
with [allow-chars: "" single-chars: ""]
; decimal field
dfield: rfield with [allow-chars: "0123456789.-" single-chars: ".-"]
; integer field
ifield: rfield with [allow-chars: "0123456789-" single-chars: "-"]
;hexadecimal field
hfield: rfield with [allow-chars: "0123456789ABCDEF#" single-chars: "#"]
; date field
date-field: rfield with [allow-chars: "0123456789/" single-chars: ""]
]
view layout [
styles my-styles
style lab label 120 right
backdrop 0.150.0
across
lab "Decimal field"
dfield
return
lab "Integer field"
ifield
return
lab "Hex field"
hfield
return
lab "Date (99/99/9999)"
date-field
return
lab "Just ABCDEFG"
rfield with [allow-chars: "ABCDEFG" single-chars: ""]
]