formating fields
[1/3] from: potrzebie::magic::fr at: 9-Nov-2001 12:27
hi again,
is there a way to format fields
i.e. ##/####
where the / is not taken in the value
regards,
etienne
[2/3] from: greggirwin:mindspring at: 9-Nov-2001 12:43
Hi Etienne,
<< is there a way to format fields >>
The closest thing I know of is Larry Palmiter's format.r. It works more like
C' sprintf than VB's Format function, just FYI.
--Gregg
[3/3] from: media:quazart at: 9-Nov-2001 14:47
Hello,
To make filters you must use a face within another face which has a detect
feel. The detect feel allows you to filter out unwanted events cleanly....
its really easy, it just takes a little work.
run the following:
-------------------------------------------
rebol[]
gui: layout [ bx: box 200x100]
filter: "abc/"
print "" ;open the console right away... so it does interrupt later
gui2: layout [subbx: field]
bx/feel/detect: func [face event][
switch event/type [
key [
;print event/key
either find filter event/key [
print ["letter" event/key "invalid... keystroke filtered out !"]
return none
][
return event
]
]
]
event
]
bx/pane: append copy [] gui2
view gui
----------------------------------------------
you see that you can effectively filter out any letter this way... you
could provide much nicer control just by putting some cool filter in the
detect function above..
try these two, they are a little more "hacky"... ;-)
---------------------------------
rebol[]
gui: layout [ bx: box 200x100]
filter: "abc/"
print "" ;open the console right away... so it does interrupt later
gui2: layout [subbx: field]
bx/feel/detect: func [face event][
switch event/type [
key [
;print event/key
either find filter event/key [
print ["letter" event/key "invalid... keystroke filtered out !"]
insert system/view/caret "*"
system/view/caret: next system/view/caret
show subbx
return none
][
;probe subbx/data
return event
]
]
]
event
]
bx/pane: append copy [] gui2
view gui
---------------------------------------------------
rebol[]
gui: layout [ bx: box 200x100]
filter: "abc/"
print "" ;open the console right away... so it does interrupt later
gui2: layout [subbx: field]
bx/feel/detect: func [face event][
switch event/type [
key [
;print event/key
either find filter event/key [
alert rejoin [ {"} filter {" are not valid keys!}]
return none
][
;probe subbx/data
return event
]
]
]
event
]
bx/pane: append copy [] gui2
view gui
--------
HOPE THIS HELPS!!!
-MAx