[REBOL] Re: VID focus questions
From: brett:codeconscious at: 6-Feb-2002 1:09
Hi David,
> > How does one do the following:
> >
> > 1: give focus to a check, choice, button
> > 2: keep focus off of an info or list
> > 3: make radio's non-exclusive
> > 4: make a choice keycode pickable
I see you have replies to 2 and 3 so I'll make reply to 1.
Focus can be set with the FOCUS function:
view layout [
my-check: check
do [focus my-check]
]
However, a check doesn't look like it is focussed. Maybe the redraw function
for the check and the other styles need amendment.
I'm sipping on some wine, so it has probably affected my priorities! Instead
of addressing the visual aspect of focussing
I got involved with what happens if you hit the space bar. In Windows doing
so when a check box is focussed will toggle
the check box off and on. So this is what I've done with this next bit of
code:
view layout [
my-check: check
do [my-check/feel: make my-check/feel [
engage: func [face action event] [
either all [equal? event/type 'key equal? event/key #" "] [
system/view/vid/vid-feel/check/engage face 'down event
] [
system/view/vid/vid-feel/check/engage face action event
]
]
]
]
do [focus my-check]
]
In essence I've replaced the feel for the check box with a modified version.
In the modified version the engage function is redefined to trap the space
bar keystroke. If a space keystoke is detected, a simulated mouse down call
is made to the original engage function. Other calls to engage are routed to
the original functionality.
Now I shoudl sleep off this nice wine :)
I hope this helps *and* is relevant!
Brett