Is there a way to trap the Alt key as event/alternate was skipped from implement?
I got the following example from http://www.codeconscious.com/rebol/view-tips.html
Does nothing on XP?
view layout [ button 'Click me to hide!' 120 feel [ engage: func [face action event][ switch action [ down [face/state: on] alt-down [face/state: on] up [if face/state [hide face exit] face/state: off] alt-up [if face/state [hide face exit] face/state: off] over [face/state: on] away [face/state: off] ] cue face action show face ] ] ]
Thanks!
posted by: OneArb 27-Dec-2016/12:49:53-8:00
I use control-key combinations and special keys like this:
R E B O L [] view layout [ box 100 key #"^M" [alert "control-m"] key keycode [insert] [alert "insert key"] ]
Haven't had the need for alt. You can find key codes with this script:
insert-event-func func [f e] [if e/type = 'key [print mold e/key] e] view layout [text "Type keys to see their character/keycode"]
posted by: Nick 28-Dec-2016/19:22:42-8:00
BTW, be aware that the default pop-up touch screen keyboards on all tablets running Windows 8 or newer don't include an ALT key anywhere. Users need to dig several menu layers deep in the Windows settings to enable the traditional 'standard' keyboard layout, and then switch to it manually, to get the ALT key. Also, the Windows CTRL key maps to the Command key on Mac, so it's reasonable to consider CTRL as a first choice for key combinations.
posted by: Nick 1-Jan-2017/19:55:55-8:00
Thanks Nick,
My plan was deceiving simple.
Let people choose which key (combination) they wanted to use by offering the opportunity to map functions or even buttons to whichever key (combo) they'd happen to press.
Running your script I get the following:
Enter key #"^M" Ctl Enter #"^/" delete #"^~" backspace #"^H"
Ctl-H does wipe the entire text entered in a field.
Any idea of this key mapping source?
posted by: OneArb 2-Jan-2017/9:06:20-8:00
The key mapping for a field comes from CTX-TEXT. I don't believe it's possible to capture the ALT key (iirc, ALT-UP and ALT-DOWN refer to the right mouse button).