[REBOL] Re: fields and keyboard
From: rotenca:telvia:it at: 30-Jan-2002 14:38
Hi Brett
> But I cannot. Maybe I'm missing something really simple, but I can't find
> a simple way to extend the existing field behaviour with the uppercase
> behaviour you want.
>
> Any one else got some ideas?!!
This is my hack (another way is to modify system/ctx-text/ctx-edit):
upper-eng: func [face act event] bind [
switch act [
down [
either not-equal? face view*/focal-face [
focus face
view*/caret: offset-to-caret face event/offset
] [
view*/highlight-start:
view*/highlight-end: none
view*/caret: offset-to-caret face event/offset
]
show face
]
over [
if not-equal? view*/caret offset-to-caret face event/offset [
if not view*/highlight-start [view*/highlight-start:
view*/caret]
view*/highlight-end: view*/caret: offset-to-caret face
event/offset
show face
]
]
key [
edit-text face make object! [ ;modified part of engage
shift: event/shift
control: event/control
key: either char? event/key [first uppercase form
event/key][event/key]
] get in face 'action
]
]
] in system/words/ctx-text 'self
l: layout [f: field "" feel [engage: :upper-eng]]
view l
---
Ciao
Romano