[REBOL] Re: Getting function keys to identify/bind to a field.
From: greggirwin::mindspring::com at: 13-Dec-2005 10:33
Hi Mike,
MY> I would like to be able to press the "F4" key to prompt for a field.
MY> Using this code it doesn't work as I would have imagined.
If I understand you, the goal is to have a hot-key that can pop up a
prompt for any field. If so, you need to do it a different way. e.g.
view layout [key keycode 'F4 [print "Hello from F4"]]
The catch is that the general key handler doesn't know which face has
focus, so you need to track or dispatch on that yourself.
view layout [
f-1: field "I'm #1!"
f-2: field "I'm #2"
key keycode 'F4 [
switch system/view/focal-face reduce [
f-1 [print "field 1 has focus"]
f-2 [print "field 2 has focus"]
]
]
]
If you just set a custom word for the face and access that for your
prompt info, just keep in mind that system/view/focal-face will be
NONE if no face has focus.
-- Gregg