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.I'm confused. This really shouldn't be that hard in a system that's designed for non programmers to make use of.
Dave David Hawley wrote: > Brett, > > I still can't get focus to work on check except in the case of a do [ > focus my-check ] > and then only on the first check. I liked your space key to turn check > on/off and tried to generalize as follows: > > stylize/master > [ space-check: check with [ feel: make 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] > ] > ] > ] > ] > > view layout [ > my-check1: space-check > my-check2: space-check > ] > > The first space-check works as expected, but when I move the mouse > over the second, click it on-off a few times, the first still gets > toggled when I click the space key. > > Any ideas on what I'm doing wrong? > > Brett Handley wrote: > >> 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 >> > -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with "unsubscribe" in the subject, without the quotes.
