size-text measures the length and height of the pixels used by a string and so isn't any use to measure the number of characters in one. Example from the console...
>> layout [t: text "abc"] size-text t
== 22x15
>> layout [t: text "123"] size-text t
== 23x15
length? is the right word to use as a string, like blocks and many other REBOL datatypes is a series...
>> series? "a"
== true
See? :-)
One way to restrict what you can fit in a field is to have a
focus face in its block. A quick example...
view layout [
field [
if 4 <> length? face/text [
focus face
system/view/caret
system/view/highlight-start:
system/view/highlight-end:
tail system/view/caret
show face
]
]
field
]
The extra code there controls the block-marking of the text . (Play with it to get the effect you'd like.) There, you're restricted to 4 characters in the first field.
(Sorry - a rushed post - supposed to be somewhere;)