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


----- Original Message -----
From: "Etienne Sevin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, November 09, 2001 6:27 AM
Subject: [REBOL] formating fields


> hi again,
>
> is there a way to format fields
>
> i.e. ##/####
>
> where the / is not taken in the value
>
> regards,
>
> etienne
>
>
> --
> To unsubscribe from this list, please send an email to
> [EMAIL PROTECTED] with "unsubscribe" in the
> subject, without the quotes.
>

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to