[REBOL] Re: VID focus questions
From: brett:codeconscious at: 7-Feb-2002 22:12
Hi Dave,
> Actually, on further research, it appears that this scheme only works
> when hte check is given focus with a [ do focus] - if focus is moves to
> say a field, then there is no way to click on the check and get the
> "space" focus back to it.
Fixed that now.
> I'm confused. This really shouldn't be that
> hard in a system that's designed for non programmers to make use of.
I think this sort of feature is important, because it is has a long
tradition
in GUIs. VID is a remarkably small GUI framework and I believe RT
will evolve these sort of features in VID over time. Or someone else
will produce a framework that satisfies the standard features list.
A work in progress I guess.
Back to the code.
I've worked out now that by testing for mouse down I can set the focus.
I went on provide tabbing between multiple checkboxes.
For bonus marks, I tried highlighting which checkbox actually has focus.
I haven't thought about how to apply such findings to other styles.
I also don't know if I've broken any VID rules, so I don't know
how or whether it can be applied more generally.
But maybe it is a couple of steps closer.
modified-check-feel: [
; Basic highlighting of the checkbox with focus
redraw: function [face action pos] [bvlc cond-c cond-f] [
cond-c: equal? face/edge/color bvlc: svv/vid-colors/bevel
cond-f: equal? face system/view/focal-face
if equal? cond-c cond-f [
face/edge/color: either cond-f [black] [bvlc]
]
svvf/check/redraw face action pos
]
; Space bar toggles check - tab moves to next tabbed item
engage: func [face action event] [
either equal? event/type 'key [
switch event/key [
#" " [
svvf/check/engage face 'down event
]
#"^-" [
focus either event/shift [
ctx-text/back-field face
] [
ctx-text/next-field face
]
]
]
] [
if equal? event/type 'down [focus face]
svvf/check/engage face action event
]
]
]
stylize/master [
space-check: check with [
feel: make feel modified-check-feel
flags: [check tabbed]
]
]
view layout [
across
space-check [print "action test first check"]
space-check space-check space-check return
field
]
Regards,
Brett